1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-17 15:53:28 +00:00

[password session] Disable for non-database users

This commit is contained in:
zhengxie
2019-01-02 11:11:16 +08:00
parent fac93bfe82
commit aa699dd40f

View File

@@ -8,5 +8,9 @@ class CheckPasswordHash(object):
"""Logout user if value of hash key in session is not equal to current password hash""" """Logout user if value of hash key in session is not equal to current password hash"""
def process_view(self, request, *args, **kwargs): def process_view(self, request, *args, **kwargs):
if getattr(request.user, 'is_authenticated') and request.user.is_authenticated(): if getattr(request.user, 'is_authenticated') and request.user.is_authenticated():
if request.user.enc_password == '!':
# Disable for LDAP/Shibboleth/SAML/... users.
return None
if request.session.get(PASSWORD_HASH_KEY) != get_password_hash(request.user): if request.session.get(PASSWORD_HASH_KEY) != get_password_hash(request.user):
logout(request) logout(request)