photonix icon indicating copy to clipboard operation
photonix copied to clipboard

Starting fresh fails to login

Open github0013 opened this issue 3 years ago • 14 comments

Describe the bug At the very initial setup, after /onboarding/step5 it tries to redirect to /login page, but it gives TypeError: Cannot read property 'form' of null and only shows a black empty page.

To Reproduce Steps to reproduce the behavior:

  1. Install and run as https://photonix.org/docs/installing/#setting-up
  2. create user and library
  3. login the first time and set it up
  4. "we are all set"
  5. black empty screen

Expected behavior I think login form should show.

Screenshots

This is after /onboarding/step5 and moving to /login. Photonix_Photo_Manager

Photonix_Photo_Manager-2

Desktop (please complete the following information):

  • OS: OSX 11.2.3 (20D91)
  • Browser Version 89.0.4389.128 (Official Build) (arm64)

github0013 avatar Apr 29 '21 04:04 github0013

Hi github0013, thanks for reporting the issue. Could you tell me where the server is running - locally, VM or another machine? If on another machine what is the OS and architecture? I see you mentioned the browser is arm64 so I'm thinking the architecture might be the reason. Thanks.

damianmoore avatar Apr 29 '21 08:04 damianmoore

My client is OSX. I run stuff on my local ubuntu server. On the ubuntu, I have docker installed to run Photonix.

▶ uname -a Linux ubuntu 5.4.0-66-generic #74-Ubuntu SMP Wed Jan 27 22:54:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

▶ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.2 LTS Release: 20.04 Codename: focal

▶ docker-compose --version docker-compose version 1.28.4, build cabd5cfb

▶ docker --version Docker version 20.10.3, build 48d30b5

github0013 avatar Apr 29 '21 21:04 github0013

I tried my iPhone with different browsers (Brave, Safari and Chrome), they resulted the same black blank page.

photonix    | 192.168.1.176 - - [01/May/2021:00:01:20 +0000] "POST /graphql HTTP/1.1" 200 29 "http://ubuntu.local:8888/login" "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1"
photonix    | Traceback (most recent call last):
photonix    |   File "/usr/local/lib/python3.8/site-packages/promise/promise.py", line 489, in _resolve_from_executor
photonix    |     executor(resolve, reject)
photonix    |   File "/usr/local/lib/python3.8/site-packages/promise/promise.py", line 756, in executor
photonix    |     return resolve(f(*args, **kwargs))
photonix    |   File "/usr/local/lib/python3.8/site-packages/graphql/execution/middleware.py", line 75, in make_it_promise
photonix    |     return next(*args, **kwargs)
photonix    |   File "/srv/photonix/accounts/schema.py", line 116, in resolve_after_signup
photonix    |     if user.has_configured_image_analysis:
photonix    |   File "/usr/local/lib/python3.8/site-packages/django/utils/functional.py", line 225, in inner
photonix    |     return func(self._wrapped, *args)
photonix    | graphql.error.located_error.GraphQLLocatedError: 'AnonymousUser' object has no attribute 'has_configured_image_analysis'
photonix    |
photonix    | 192.168.1.176 - - [01/May/2021:00:01:20 +0000] "POST /graphql HTTP/1.1" 200 185 "http://ubuntu.local:8888/login" "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1"

Looking at the logs, I noticed graphql.error.located_error.GraphQLLocatedError: 'AnonymousUser' object has no attribute 'has_configured_image_analysis' line. Is this maybe the reason?

github0013 avatar May 01 '21 00:05 github0013

Thanks for the extra detail @github0013. I'll try and reproduce.

damianmoore avatar May 01 '21 19:05 damianmoore

Exactly the same issue here!

Tried on latest OSX with latest Docker, with iOS apps on iPad and iPhone as well as chrome and Firefox browsers.

MickMake avatar May 01 '21 22:05 MickMake

Fresh install and experiencing the same blank screen login problem Also running Ubuntu 20.04 docker-compose version 1.29.2 Docker version 20.10.7, build f0df350

MetallicAchu avatar Jun 24 '21 05:06 MetallicAchu

Same issue here. It worked fine to create the first user. Then, I ran the phython script to create a second user and can no longer get the login screen to come up. It shows the login box for a second, then it errors out and disappears, leaving a black screen.

Running from Docker (docker-compose) on Synology NAS accessing site through an nginx reverse proxy.

bjhiltbrand avatar Jul 07 '21 17:07 bjhiltbrand

I have the same issue now after "reinstalling" my setup. I had set up a site with v0.9.0 before and everything was working, also after updating to the latest version regularly. I wanted to start anew however and deleted all my data (except the photos folder). After onboarding, I now face this issue.

bartlibert avatar Aug 03 '21 14:08 bartlibert

Same here. "Cannot read property 'form' of null " on freshly installed 20.04. It seems Photonix is broken in its current version.

gorfreed avatar Aug 27 '21 10:08 gorfreed

This issue was caused by has_config_persional_info field set to f in accounts_user PostgreSQL table of photonix DB. It looks like both Django's createsuperuser and onboarding step 1 forget to set this value properly to t.

Workaround for this issue is pretty simple:

  1. Connect to your Docker host
  2. Execute the following command:
docker exec -it photonix-postgres psql -U postgres photonix -c "update accounts_user set has_config_persional_info='t';"

That's it!

Vlad1mir-D avatar Aug 27 '21 11:08 Vlad1mir-D

This issue was caused by has_config_persional_info field set to f in accounts_user PostgreSQL table of photonix DB. It looks like both Django's createsuperuser and onboarding step 1 forget to set this value properly to t.

Workaround for this issue is pretty simple:

  1. Connect to your Docker host
  2. Execute the following command:
docker exec -it photonix-postgres psql -U postgres photonix -c "update accounts_user set has_config_persional_info='t';"

That's it!

Thank you so much for that workaround. It worked great!

bjhiltbrand avatar Aug 27 '21 22:08 bjhiltbrand

Hit this also, I wondered if the cause of the bug is what looks like a typo in a property name (persional for personal) but no luck finding an instance that tries to set has_config_personal_info instead.

NB: https://github.com/photonixapp/photonix/pull/352 below is not expected to resolve this issue, only to fix the typo and eliminate that as a possible cause (or potential for future problems) 😁

I see that https://github.com/photonixapp/photonix/blob/4bdd939780c16df97f056262df245009c26cc618/photonix/accounts/management/commands/create_admin_from_env.py#L34-L37 and https://github.com/photonixapp/photonix/blob/4bdd939780c16df97f056262df245009c26cc618/photonix/photos/management/commands/import_demo_photos.py#L37-L43 both apply the has_config_persional_info as True. This might mean that tests against demo environments do not reveal the behaviour which is observed when bringing a site up from the install docs. Environments setting ADMIN_USERNAME and ADMN_PASSWORD from env/docker-compose.yml won't observe this broken behaviour.

If that behaviour is required for the admin account to work when created as per install docs, then perhaps there's an event on Django's createsuperuser (or account create) command which we can react to and apply the permission there as appropriate?

I suspect that the bug to fix here isn't "ensure every user who can log in has has_config_personal_info == True", but "ensure users can view the app regardless of has_config_personal_info value". (If the flag should prevent login, then we'd see an HTTP 403, right?) So the SQL update above is a workaround to keep the system in a non-broken state temporarily AFAICT.

xurizaemon avatar Sep 25 '21 19:09 xurizaemon

i am using the latest compose version and i cannot login after creating the super user as well. loading... never ends. i turned all the booleans f to t in accounts_user but no luck. created another admin user with create_admin_from_env but no luck. cannot login at all

audioscavenger avatar Nov 06 '21 23:11 audioscavenger

This issue was caused by has_config_persional_info field set to f in accounts_user PostgreSQL table of photonix DB. It looks like both Django's createsuperuser and onboarding step 1 forget to set this value properly to t.

Workaround for this issue is pretty simple:

  1. Connect to your Docker host
  2. Execute the following command:
docker exec -it photonix-postgres psql -U postgres photonix -c "update accounts_user set has_config_persional_info='t';"

That's it!

Brilliant!

DennisFaucher avatar Apr 22 '23 23:04 DennisFaucher