Skip to content
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

Feature/Manage Two-Factor Auth in V2 [PLAT-963] #8565

Conversation

pattisdr
Copy link
Contributor

@pattisdr pattisdr commented Jul 19, 2018

Purpose

Needed for Embosf User Account Settings Page

Changes

Added a /v2/users/<uid>/settings/ endpoint, GET/PATCH only

  • two_factor_enabled, writeable boolean, turns two factor on/off
  • two_factor_verification (write-only int field), enter 2f code
  • attempting to update two_factor_verification if two_factor_enabled is false should error

QA Notes

Documentation

Located here: CenterForOpenScience/developer.osf.io#24

Side Effects

Ticket

https://openscience.atlassian.net/browse/PLAT-963

two_factor_enabled = ser.BooleanField(write_only=True, required=False)
two_factor_verification = ser.IntegerField(write_only=True, required=False)

def to_representation(self, instance):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Similarly implemented in #8536.

Allows request/response to use different serializers. This is different than different serializers for different types of request methods.

user_addon = None
if 'two_factor_enabled' == attr:
if value:
if not instance.has_addon('twofactor'):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If two factor already enabled and attempting to enable, ignores. Likewise for disabling.

@pattisdr
Copy link
Contributor Author

@Johnetordoff is going to be adding commits to my PR from here. #8559.
His mailing list fields will be adding to the usersettings serializer and my update method modified to change mailing list fields as well.

@pattisdr
Copy link
Contributor Author

These commits have been pulled into @Johnetordoff 's PR #8559

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.

None yet

1 participant