Skip to content

Conversation

@MAkcanca
Copy link
Member

@MAkcanca MAkcanca commented Mar 25, 2025

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

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):
Copy link
Member Author

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

@MAkcanca MAkcanca requested a review from moggers87 March 25, 2025 23:37
@moggers87
Copy link
Collaborator

Tests are failing due to #754

@moggers87
Copy link
Collaborator

@MAkcanca can up update your branch with the latest from master? Thanks

@MAkcanca
Copy link
Member Author

Merged latest branch. Thank you for your efforts on #754 with @claudep

Copy link
Collaborator

@moggers87 moggers87 left a 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 👍

@MAkcanca MAkcanca requested a review from moggers87 April 5, 2025 19:36
Copy link
Collaborator

@moggers87 moggers87 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

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.

2 participants