-
-
Notifications
You must be signed in to change notification settings - Fork 453
Change EmailDevice default to unconfirmed until verified #752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
if not user or user.is_anonymous: | ||
return | ||
if hasattr(user, USER_DEFAULT_DEVICE_ATTR_NAME): | ||
return getattr(user, USER_DEFAULT_DEVICE_ATTR_NAME) | ||
for device in devices_for_user(user): | ||
for device in devices_for_user(user, confirmed=confirmed): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per django-otp docstring for this function, it already defaults to True
Tests are failing due to #754 |
@MAkcanca can up update your branch with the latest from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few tests missing, otherwise looks good 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Description
We change EmailDevice default to unconfirmed (confirmed False) because until the email is actually verified with OTP, we should not assume that flow is finished and user properly setup the OTP. This changes the default property confirmed to False, and adds a test to ensure we get a device created in a confirmed False state.
Motivation and Context
#751
#562
How Has This Been Tested?
Ran existing tests + added a new single test to confirm it creates an unconfirmed device if code is not validated. I also tested with the provided example app, starting the setup flow with email, then cancelling it without entering the code, checking from the shell/admin that email device is created with first unconfirmed, then confirmed state.
Types of changes
Checklist: