def reset_password(request): try: success = False if request.POST.has_key('resetKey'): reset_key = request.POST['resetKey'] Setting.log.info("Reset password attemp for key:"+reset_key) uw = UserWorker() init_db() username = uw.find_username_by_reset_password_key(reset_key) email = uw.get_user_email(username) if email != "": Setting.log.info("Reset password attemp for user:"******"user password changed to "+new_password) (title, text, html) = get_reset_password_template() text = text.format(new_password) html = html.format(new_password) Setting.log.info("got template - title is "+title) sendmail(email, title, text, html) Setting.log.info("mail sent to "+email) success = True except Exception as ex: Setting.log.log_exception(ex) return { 'success': success}