Projet

Général

Profil

« Précédent | Suivant » 

Révision c44a9fb6

Ajouté par Serghei Mihai il y a plus de 7 ans

redirect to password change page if required by proxied application (#14037)

Voir les différences:

mandayejs/do_login.js
64 64
         input.auth_success = page.evaluate(function(){
65 65
             return auth_success();
66 66
         });
67
         input.password_change_required = page.evaluate(function() {
68
             if (typeof(password_change_required) == 'function')
69
                 return password_change_required();
70
             return false;
71
         });
67 72
     }
68 73

  
74
      if (input.password_change_required) {
75
        output['result'] = 'redirect';
76
        output['reason'] = 'password_change_required';
77
        output['url'] = page.url;
78
        console.log(JSON.stringify(output));
79
        phantom.exit();
80
    }
81

  
69 82
    if (!input.auth_success){
70 83
        output['result'] = 'failure';
71 84
        output['reason'] = 'authentication';
mandayejs/mandaye/views.py
149 149
    result = exec_phantom(login_info)
150 150
    logger.debug(result)
151 151

  
152
    if result.get('result') != 'ok':
152
    if result.get('result') == 'failure':
153 153
        logger.debug('authentication failed')
154 154
        logger.debug("redirecting to {}".format(resolve_url('associate')))
155 155
        credentials.delete()
156 156
        messages.error(request, _('wrong user credentials'))
157 157
        url = resolve_url('associate')
158
    elif result.get('result') == 'redirect':
159
        url = result.get('url', '/')
158 160
    else:
159 161
        credentials.linked = True
160 162
        credentials.save()
mandayejs/static/teamnet/js/auth.checker.js
4 4
           return true;
5 5
       return false;
6 6
    };
7
    window.password_change_required = function() {
8
        if ($("input[type='password'][name='old_pass']").length > 0 &&
9
            $("input[type='password'][name='new_pass']").length > 0 &&
10
            $("input[type='password'][name='conf_pass']").length > 0)
11
            return true;
12
        return false;
13
    };
7 14
});

Formats disponibles : Unified diff