コード例 #1
0
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}
コード例 #2
0
def forgot_password(request):
    try:
        success = False
        if request.POST.has_key('username'):
            username = request.POST['username']
            
            Setting.log.info("Forgot password attemp for user:"******"":
                Setting.log.info("Forgot password attemp for user:"******"Forgot password attemp for user:"******"receiving email template")
                (title, text, html) = get_forgot_password_template()

                site_prefix = "www"
                if ( Setting.mode == "beta" ):
                    site_prefix="beta"
                    
                text = text.format("http://"+site_prefix+".yeksatr.com/?forgotPasswordKey="+reset_password_key)
                html = html.format("http://"+site_prefix+".yeksatr.com/?forgotPasswordKey="+reset_password_key)
                
                Setting.log.info("got template - title is "+title)
                sendmail(email, title, text, html)
                Setting.log.info("mail sent to "+email)
                
    except Exception as ex:
        Setting.log.log_exception(ex)

    return Response('')