Пример #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')
Пример #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')