Skip to content

Commit

Permalink
fix: radius user auth skip backend
Browse files Browse the repository at this point in the history
  • Loading branch information
BaiJiangJie authored and ibuler committed Jan 13, 2025
1 parent 8198620 commit 583486e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions apps/authentication/mixins.py
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ def _get_backends(return_tuples=False):
def authenticate(request=None, **credentials):
"""
If the given credentials are valid, return a User object.
之所以 hack 这个 auticate
之所以 hack 这个 authenticate
"""
username = credentials.get('username')

@@ -500,10 +500,12 @@ class AuthMixin(CommonMixin, AuthPreCheckMixin, AuthACLMixin, AuthFaceMixin, MFA
key_prefix_captcha = "_LOGIN_INVALID_{}"

def _check_auth_user_is_valid(self, username, password, public_key):
user = authenticate(
self.request, username=username,
password=password, public_key=public_key
)
credentials = {'username': username}
if password:
credentials['password'] = password
if public_key:
credentials['public_key'] = public_key
user = authenticate(self.request, **credentials)
if not user:
self.raise_credential_error(errors.reason_password_failed)

0 comments on commit 583486e

Please sign in to comment.