Skip to content

Conversation

@bdewilde
Copy link
Member

@bdewilde bdewilde commented Apr 5, 2025

changes

  • adds /register/resend api endpoint to re-send a registration confirmation email
  • refactors code to share underlying logic with existing /register endpoint
  • allows uncomfirmed users to log in

context

https://app.asana.com/0/1206730431337718/1209825705665584/f

questions

  • does this actually work? i don't have any unit tests for it, and i'm not sure how i could add any. auth stuff is confusing and not something i'm confident in!

@bdewilde bdewilde changed the base branch from main to develop April 5, 2025 18:44
@bdewilde bdewilde marked this pull request as ready for review April 5, 2025 18:46
@bdewilde bdewilde requested a review from sophiaharms April 5, 2025 18:46
@sophiaharms
Copy link
Contributor

This doesn't work because of the order of things required. Executing /auth/register/resend returns {"msg": "Missing Authorization Header"} because submitting to /auth/login before a confirmation email link has been opened returns {"error": "Unauthorized","message": "user has been created but is not yet confirmed"}.

You should be able to get a valid auth token from /auth/login even when user is_confirmed = 0. Other endpoints can have a guard that prevents response without confirmation, and I have middleware written into the web app to hide most views until confirmation is done, but you have to be able to log in in order to securely request a new email.

The email resend itself does work as expected. I just need to be able to trigger it from an unconfirmed user.

@bdewilde
Copy link
Member Author

I think I'm going to need your help implementing this. How familiar are you with Flask, jwt, etc?

@bdewilde
Copy link
Member Author

bdewilde commented May 6, 2025

@sophiaharms Let me know if this does what you need!

Comment on lines -72 to +74
return unauthorized_error("user has been created but is not yet confirmed")
# TODO: confirm that we want to allow uncomfirmed user logins
current_app.logger.warning("%s not yet confirmed")
# return unauthorized_error("user has been created but is not yet confirmed")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sophiaharms belatedly following back up on this -- is this the behavior you need? if so, do you recommend i put safeguards in for other endpoints to require user confirmation??

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bdewilde colandr-db is failing on both prod and dev builds. I backed up a few commits on develop to confirm this wasn't happening previously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants