소스 검색

[auth] Do not fail on backends without usernames

Romain Rigaux 4 년 전
부모
커밋
9364480ffe
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      desktop/core/src/desktop/auth/backend.py

+ 2 - 1
desktop/core/src/desktop/auth/backend.py

@@ -280,11 +280,12 @@ class AllowFirstUserDjangoBackend(django.contrib.auth.backends.ModelBackend):
     else:
       request = None
 
-    username = kwargs['username']
     password = kwargs['password']
 
     if 'email' in kwargs:
       username = kwargs['email']
+    else:
+      username = kwargs['username']
     username = force_username_case(username)
 
     user = super(AllowFirstUserDjangoBackend, self).authenticate(request, username=username, password=password)