diff --git a/adsws/accounts/config.py b/adsws/accounts/config.py index b5e0234..23131c7 100644 --- a/adsws/accounts/config.py +++ b/adsws/accounts/config.py @@ -41,4 +41,4 @@ GOOGLE_RECAPTCHA_ENDPOINT = 'https://www.google.com/recaptcha/api/siteverify' MAIL_DEFAULT_SENDER = 'no-reply@adslabs.org' -PASSWORD_RESET_URL = 'https://ui.adsabs.harvard.edu/#user/account/verify/reset-password' +VERIFY_URL = 'https://ui.adsabs.harvard.edu/#user/account/verify' diff --git a/adsws/accounts/views.py b/adsws/accounts/views.py index 039306d..1cad159 100644 --- a/adsws/accounts/views.py +++ b/adsws/accounts/views.py @@ -22,6 +22,7 @@ from sqlalchemy import func from sqlalchemy.orm import load_only from adsmutils import get_date +from urlparse import urljoin class StatusView(Resource): """ @@ -115,7 +116,7 @@ def post(self, token): send_email( email_addr=token, email_template=PasswordResetEmail, - base_url=current_app.config['PASSWORD_RESET_URL'], + base_url=urljoin(current_app.config['VERIFY_URL'], 'reset-password'), payload=token ) return {"message": "success"}, 200 @@ -459,7 +460,6 @@ def post(self): data = get_post_data(request) email = data['email'] password = data['password'] - verify_url = data['verify_url'] except (AttributeError, KeyError): return {'error': 'malformed request'}, 400 @@ -473,7 +473,7 @@ def post(self): }, 403 send_email( email_addr=email, - base_url=verify_url, + base_url=urljoin(current_app.config['VERIFY_URL'], 'change-email'), email_template=VerificationEmail, payload=[email, u.id] ) @@ -609,7 +609,6 @@ def post(self): email = data['email'] password = data['password1'] repeated = data['password2'] - verify_url = data['verify_url'] except (AttributeError, KeyError): return {'error': 'malformed request'}, 400 @@ -628,7 +627,7 @@ def post(self): ' registered for {0}'.format(email)}, 409 send_email( email_addr=email, - base_url=verify_url, + base_url=urljoin(current_app.config['VERIFY_URL'], 'register'), email_template=WelcomeVerificationEmail, payload=email )