-
Notifications
You must be signed in to change notification settings - Fork 2
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
#161967011 Implements password reset #12
Conversation
authors/apps/authentication/views.py
Outdated
user = instance.get_user(email=payload["email"]) | ||
|
||
password = request.data.get('password', None) | ||
serializer = self.serializer_class(request.user, data=request.data, partial=True) |
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.
line too long (89 > 79 characters)
authors/apps/authentication/views.py
Outdated
def put(self, request, token): | ||
payload = jwt.decode(token, settings.SECRET_KEY) | ||
user = instance.get_user(email=payload["email"]) | ||
|
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.
blank line contains whitespace
authors/apps/authentication/views.py
Outdated
msg.send() | ||
|
||
return Response({"message": "A password reset email has been sent to your account!", | ||
"url": reset_url}, status=status.HTTP_200_OK) |
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.
continuation line under-indented for visual indent
authors/apps/authentication/views.py
Outdated
msg.attach_alternative(html_content, "text/html") | ||
msg.send() | ||
|
||
return Response({"message": "A password reset email has been sent to your account!", |
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.
line too long (92 > 79 characters)
authors/settings.py
Outdated
@@ -72,6 +72,13 @@ | |||
|
|||
ROOT_URLCONF = 'authors.urls' | |||
|
|||
EMAIL_HOST = 'smtp.gmail.com' | |||
EMAIL_HOST_USER = 'jumanjidevs32@gmail.com' | |||
EMAIL_HOST_PASSWORD ='jumanji@32' |
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.
missing whitespace around operator
}, | ||
settings.SECRET_KEY, algorithm='HS256').decode() | ||
return token | ||
|
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.
blank line at end of file
blank line contains whitespace
"exp": datetime.datetime.utcnow() + datetime.timedelta(minutes=720) | ||
}, | ||
settings.SECRET_KEY, algorithm='HS256').decode() | ||
return token |
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.
trailing whitespace
{ | ||
"email": email, | ||
"iat": datetime.datetime.utcnow(), | ||
"exp": datetime.datetime.utcnow() + datetime.timedelta(minutes=720) |
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.
line too long (83 > 79 characters)
@staticmethod | ||
def generate_reset_token(email): | ||
""" generates reset password token """ | ||
|
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.
blank line contains whitespace
@@ -1,6 +1,9 @@ | |||
import datetime | |||
import logging | |||
|
|||
import datetime | |||
import logging |
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.
redefinition of unused 'logging' from line 2
The functionality works awesome. I have tested it. Good work. |
c5d0a03
to
a4e5e58
Compare
On it |
a4e5e58
to
48d64a3
Compare
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.
Good work.
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.
This is ready to merge cc @mirr254
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.
Nice work.
- send a password reset email - update user password [finishes #161967011]
48d64a3
to
d931e97
Compare
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.
The functionality is well implemented. However, your .gitignore has redundant entries for .vscode and .DS_store
@@ -24,6 +24,9 @@ var/ | |||
.installed.cfg | |||
*.egg | |||
.idea/ | |||
.DS_Store |
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.
.DS_Store and .vscode entries are redundant in .gitignore
What does this PR do?
Implements password reset using email
Description of Task to be completed?
Implements password reset using email
write tests for email reset
How should this be manually tested?
Fire up Postman and test the following endpoints:
With the following payload:
Reset url will come with a token
With the following payload:
Any background context you want to provide?
What are the relevant pivotal tracker stories?
#161967011
Screenshots (if appropriate)
Questions:
Checklist: