[core] Skip 2FA code verification for JWT tokens.

This commit is contained in:
Fabio Manganiello 2024-07-25 02:22:22 +02:00
parent a11f17aa8f
commit 79dc5e238d
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -419,7 +419,7 @@ class UserManager:
:return: The generated JWT token as a string. :return: The generated JWT token as a string.
:raises: :class:`platypush.exceptions.user.InvalidCredentialsException` in case of invalid credentials. :raises: :class:`platypush.exceptions.user.InvalidCredentialsException` in case of invalid credentials.
""" """
user = self.authenticate_user(username, password) user = self.authenticate_user(username, password, skip_2fa=True)
if not user: if not user:
raise InvalidCredentialsException() raise InvalidCredentialsException()
@ -457,7 +457,7 @@ class UserManager:
raise InvalidJWTTokenException('Expired JWT token') raise InvalidJWTTokenException('Expired JWT token')
user = self.authenticate_user( user = self.authenticate_user(
payload.get('username', ''), payload.get('password', '') payload.get('username', ''), payload.get('password', ''), skip_2fa=True
) )
if not user: if not user: