Esempio n. 1
0
def a_urlPassChange_02_VIEW_validateEmail(request, userId, rand1, rand2):
    validationMessage  = ''    
    QS = a_urlPassChange_02.objects.filter(user__id__exact=userId, rand1__exact=rand1, rand2__exact=rand2)
    if QS.count():
        # save the a_urlPassChange_02 instance
        instance = QS[0]
        userInstance = User.objects.get(id__exact=userId)
        
        fn_dict = {'success' : PassChange_processSuccess}
        rDict = a_urlPassChange_02.auto_form(
                                          request, 
                                          Form_a_urlPassChange_02_editPassword, 
                                          fn_dict, 
                                          'a_urlPassChange_02_VIEW_validateEmail', 
                                          'FORM_ChangePassword.html', 
                                          workObj=userInstance,
                                          redirectOnSuccess=True,
                                          viewName_kwargs = {'userId':userId, 'rand1':rand1, 'rand2':rand2}
                                          )
        if rDict['success']:
            # delete the a_urlPassChange_02 instance
            instance.delete(request=request)            
            validationMessage = 'Password changed'
        else:
            contextDict = {}
            contextDict['main_1'] = rDict['out']
            return a_urlPassChange_02.processTemplate_01(request, 'BASE.html', contextDict, mode='view')    
        
    else:
        validationMessage = 'Invalid password change request URL'
       
    contextDict = {}
    contextDict['main_1'] = validationMessage    
        
    return a_urlPassChange_02.processTemplate_01(request, 'BASE.html', contextDict, mode='view')
Esempio n. 2
0
def a_urlPassChange_02_VIEW_changeRequest(request):
        
    fn_dict = {'success' : RequestPassChange_processSuccess}
    rDict = a_urlPassChange_02.auto_form(
                                      request, 
                                      Form_a_urlPassChange_02_passChange, 
                                      fn_dict, 
                                      'a_urlPassChange_02_VIEW_changeRequest', 
                                      'F_passChange.html', 
                                      redirectOnSuccess=True,
                                      )
    if rDict['success']:
        return a_urlPassChange_02.redirectView(request, 'a_urlPassChange_02_VIEW_changeRequestSent', 'admFormPr')
    else:
        contextDict = {}
        contextDict['main_1']                       = rDict['out']
        return a_urlPassChange_02.processTemplate_01(request, 'BASE.html', contextDict, mode='view')
Esempio n. 3
0
def a_urlPassChange_02_VIEW_changeRequestSent(request):
    contextDict = {}
    contextDict['vTitle'] = "Password Change Request Sent"
    contextDict['main_1'] = "An email has been sent to your address. Click on the link enclosed to access the password change form."
    return a_urlPassChange_02.processTemplate_01(request, 'BASE.html', contextDict, mode='view')