Projet

Général

Profil

0001-ldap-user-is-not-LDAPUser-after-a-password-reset.patch

Loïc Dachary, 01 avril 2021 16:51

Télécharger (1,83 ko)

Voir les différences:

Subject: [PATCH] ldap: user is not LDAPUser after a password reset

 src/authentic2/utils/__init__.py | 4 ++--
 tests/test_ldap.py               | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)
src/authentic2/utils/__init__.py
1153 1153
):
1154 1154
    '''Simulate a normal login by forcing a backend attribute on the user instance'''
1155 1155
    # do not modify the passed user
1156
    user = copy.deepcopy(user)
1157
    user.backend = backend
1156
#    user = copy.deepcopy(user)
1157
#    user.backend = backend
1158 1158
    return login(request, user, method, service=service, record=False, **kwargs)
1159 1159

  
1160 1160

  
tests/test_ldap.py
878 878
    response.form['new_password1'] = new_password
879 879
    response.form['new_password2'] = new_password
880 880
    response = response.form.submit(status=302).maybe_follow()
881
    user = response.context['user']
882
    assert 'carlicense' in user.get_attributes(object(), {})
881 883
    # logout
882 884
    response = response.click('Logout').maybe_follow()
883 885
    return new_password
......
891 893
            'bindpw': force_text(slapd.root_bind_password),
892 894
            'basedn': u'o=ôrga',
893 895
            'use_tls': False,
896
            'attributes': ['uid', 'carLicense'],
894 897
        }
895 898
    ]
896 899
    new_password = reset_password_ldap_user(settings, app)
897
-