Skip to content

Commit

Permalink
Modified method of creating the redirect to dashboard link
Browse files Browse the repository at this point in the history
  • Loading branch information
corbinSanders committed Jul 2, 2019
1 parent 06dd69d commit 7952a31
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions framework/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import furl
import httplib as http
import urllib
import re

import markupsafe
from django.core.exceptions import ValidationError
Expand Down Expand Up @@ -50,10 +49,6 @@ def reset_password_get(auth, uid=None, token=None):
:raises: HTTPError(http.BAD_REQUEST) if verification key for the user is invalid, has expired or was used
"""

#override routes.py login_url to redirect to dashboard
next_url = re.sub(r'resetpassword/[A-z,0-9,/]+', '', request.url)
next_url = next_url + 'dashboard/'
service_url = cas.get_login_url(next_url)
# if users are logged in, log them out and redirect back to this page
if auth.logged_in:
return auth_logout(redirect_url=request.url)
Expand All @@ -71,6 +66,9 @@ def reset_password_get(auth, uid=None, token=None):
user_obj.verification_key_v2 = generate_verification_key(verification_type='password')
user_obj.save()

#override routes.py login_url to redirect to dashboard
service_url = web_url_for('dashboard', _absolute=True)

return {
'uid': user_obj._id,
'token': user_obj.verification_key_v2['token'],
Expand Down Expand Up @@ -138,15 +136,15 @@ def forgot_password_get(auth):
:param auth: the authentication context
:return
"""
#overriding the routes.py sign in url to redirect to the dashboard after login
context = {}
next_url = request.url.replace('/forgotpassword/', '/dashboard/')
context['login_url'] = cas.get_login_url(next_url)

# if users are logged in, log them out and redirect back to this page
if auth.logged_in:
return auth_logout(redirect_url=request.url)

#overriding the routes.py sign in url to redirect to the dashboard after login
context = {}
context['login_url'] = web_url_for('dashboard', _absolute=True)

return context


Expand Down

0 comments on commit 7952a31

Please sign in to comment.