How do I log into the website on a local dev environment?
Description
I am following along in the ‘README-docker-compose.md’ for setting up a local dev environment, but after completing the steps I can’t figure out how to proceed.
I can log into the admin instance (localhost:8001), but not through the portal (localhost:5000).
Without logging in I can search for the users I have created and view their profile pages. I can also get valid results back from the api directly (i.e., http://localhost:8000/v2/users/). Everything seems to be working except being able to log into a valid account.
NOTE
I am running this with Docker Desktop on a fast Windows machine. I properly setup the Loopback adapter (Microsoft KM-Test Loopback adapter) and can run migrations.
Steps
I tried creating accounts a few different ways:
- ‘Create Account Request’ form (http://localhost:5000/register/)
- Invoke Shell (user.create, user.create_confirmed, user.register, etc.)
- Generating fakes (docker-compose run --rm web python3 -m scripts.create_fakes –user [email protected]) after creating an admin account
- Injecting records directly into Postgres (osf_osfuser, osf_email, etc.)
I tried approving accounts a few different ways:
- Admin (http://localhost:8001/account/register/)
- Admin (http://localhost:8001/users/~/get_confirmation_link/)
- Invoke shell (user.confirm_email, flipping user properties like staff, active, superuser, etc).
- Invoke Shell (get_confirmation_link)
- Invoke Shell (token = user.add_unconfirmed_email('[email protected]'), user.confirm_email(token))
- Adding the
USE_EMAIL = Truevar towebsite\settings\local.pyto get the generated confirmation link. - Updating records directly in Postgres
Expected
I should be able to log into the account
Actual
I cannot log into the account
Issues
Confirming accounts
For confirming the account registration via ‘get_confirmation_link’ from either the osfio_web logs, or the admin account button, if I paste the generated url (i.e., http://localhost:5000/confirm/ufx69/U1KRiZl1T9KCVqiV1IPHuKr1IWl4lV/) I receive a 404 (BAD REQEST) response with an Invalid Token response message displayed. This does confirm the account however, the 'get_confirmation_link' button will then gray out in the admin page.
Trying to login via fakeCAS
- Localhost:5000
- Click sign in button
- Redirects to: http://192.168.168.167:8080/login?service=http://localhost:5000/login/?next=http%253A%252F%252Flocalhost%253A5000%252F
- Enter email: [email protected]
- Redirects to: http://192.168.168.167:8080/login?service=http://localhost:5000/login/?next=http:%252F%252Flocalhost:5000%252F
Actually sending emails
I havn't taken the time to setup a local SMTP server at this time.
Logs
osfio_fakecas
Trying to login
2020-09-25T16:04:15Z GET /login?service=http://localhost:5000/login/?next=http%253A%252F%252Flocalhost%253A5000%252F 200
Logging in and redirecting to http://localhost:5000/login/?next=http%3A%2F%2Flocalhost%3A5000%2F&ticket=test%40test.io
2020-09-25T16:04:18Z POST /login?service=http%3A%2F%2Flocalhost%3A5000%2Flogin%2F%3Fnext%3Dhttp%253A%252F%252Flocalhost%253A5000%252F 302
User found: username = [email protected], guid = ybf23
2020-09-25T16:04:18Z GET /p3/[email protected]&service=http://localhost:5000/login/?next=http://localhost:5000/ 200
2020-09-25T16:04:18Z GET /login?service=http://localhost:5000/login/?next=http:%252F%252Flocalhost:5000%252F 200
Trying to use the confirmation url and then login
Logging in and redirecting to http://localhost:5000/confirm/svxgc/olBzeXMIdCddvslP02hpz1kaPW4XOh/?ticket=test1%40test.io
2020-09-25T19:38:49Z GET /login?service=http://localhost:5000/confirm/svxgc/olBzeXMIdCddvslP02hpz1kaPW4XOh/&[email protected]&verification_key=IC6O3Lp7lFxgTjvt2knmFA9TkRrkHz 302
User found: username = [email protected] , guid = svxgc
2020-09-25T19:38:49Z GET /p3/[email protected]&service=http://localhost:5000/confirm/svxgc/olBzeXMIdCddvslP02hpz1kaPW4XOh/ 200
2020-09-25T19:39:32Z GET /login?service=http://localhost:5000/register/?campaign=%26next=http%253A%252F%252Flocalhost%253A5000%252F%26view_only= 200
Logging in and redirecting to http://localhost:5000/register/?campaign=&next=http%3A%2F%2Flocalhost%3A5000%2F&ticket=test1%40test.io&view_only=
2020-09-25T19:39:38Z POST /login?service=http%3A%2F%2Flocalhost%3A5000%2Fregister%2F%3Fcampaign%3D%26next%3Dhttp%253A%252F%252Flocalhost%253A5000%252F%26view_only%3D 302
User found: username = [email protected] , guid = svxgc
2020-09-25T19:39:38Z GET /p3/[email protected]&service=http://localhost:5000/register/?campaign=%26next=http://localhost:5000/%26view_only= 200
osfio_web
[werkzeug] INFO: 172.19.0.1 - - [25/Sep/2020 16:06:04] "GET /login/?next=http%3A%2F%2Flocalhost%3A5000%2F&ticket=test%40test.io HTTP/1.1" 302 -
[werkzeug] INFO: 172.19.0.1 - - [25/Sep/2020 16:06:04] "GET /login/?next=http://localhost:5000/ HTTP/1.1" 302 -
osfio_worker
[2020-09-23 19:43:32,237: ERROR/ForkPoolWorker-2] Task framework.email.tasks.send_email[a35e95e1-f6f5-42fa-a5af-0f85012be9e7] raised unexpected: OSError(99, 'Address not available')
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/celery/app/trace.py", line 375, in trace_task
R = retval = fun(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/celery/app/trace.py", line 632, in __protected_call__
return self.run(*args, **kwargs)
File "/code/framework/email/tasks.py", line 57, in send_email
password=password,
File "/code/framework/email/tasks.py", line 74, in _send_with_smtp
s = smtplib.SMTP(settings.MAIL_SERVER)
File "/usr/lib/python3.6/smtplib.py", line 251, in __init__
(code, msg) = self.connect(host, port)
File "/usr/lib/python3.6/smtplib.py", line 336, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/usr/lib/python3.6/smtplib.py", line 307, in _get_socket
self.source_address)
File "/usr/lib/python3.6/socket.py", line 724, in create_connection
raise err
File "/usr/lib/python3.6/socket.py", line 713, in create_connection
sock.connect(sa)
OSError: [Errno 99] Address not available