##// END OF EJS Templates
login: Fix password reset mail link....
johbo -
r37:0ef0b0cc default
parent child Browse files
Show More
@@ -326,7 +326,17 b' class LoginView(object):'
326 error_dict = {'recaptcha_field': _msg}
326 error_dict = {'recaptcha_field': _msg}
327 raise formencode.Invalid(_msg, _value, None,
327 raise formencode.Invalid(_msg, _value, None,
328 error_dict=error_dict)
328 error_dict=error_dict)
329 UserModel().reset_password_link(form_result)
329
330 # Generate reset URL and send mail.
331 user_email = form_result['email']
332 user = User.get_by_email(user_email)
333 password_reset_url = self.request.route_url(
334 'reset_password_confirmation',
335 _query={'key': user.api_key})
336 UserModel().reset_password_link(
337 form_result, password_reset_url)
338
339 # Display success message and redirect.
330 self.session.flash(
340 self.session.flash(
331 _('Your password reset link was sent'),
341 _('Your password reset link was sent'),
332 queue='success')
342 queue='success')
@@ -493,7 +493,7 b' class UserModel(BaseModel):'
493 log.error(traceback.format_exc())
493 log.error(traceback.format_exc())
494 raise
494 raise
495
495
496 def reset_password_link(self, data):
496 def reset_password_link(self, data, pwd_reset_url):
497 from rhodecode.lib.celerylib import tasks, run_task
497 from rhodecode.lib.celerylib import tasks, run_task
498 from rhodecode.model.notification import EmailNotificationModel
498 from rhodecode.model.notification import EmailNotificationModel
499 user_email = data['email']
499 user_email = data['email']
@@ -502,12 +502,8 b' class UserModel(BaseModel):'
502 if user:
502 if user:
503 log.debug('password reset user found %s', user)
503 log.debug('password reset user found %s', user)
504
504
505 password_reset_url = url(
506 'reset_password_confirmation', key=user.api_key,
507 qualified=True)
508
509 email_kwargs = {
505 email_kwargs = {
510 'password_reset_url': password_reset_url,
506 'password_reset_url': pwd_reset_url,
511 'user': user,
507 'user': user,
512 'email': user_email,
508 'email': user_email,
513 'date': datetime.datetime.now()
509 'date': datetime.datetime.now()
General Comments 0
You need to be logged in to leave comments. Login now