mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-01-30 12:33:11 -05:00
Feature: Add "Authentication Method" to allow existing users to sign in with LDAP (#2143)
* adds authentication method for users * fix db migration with postgres * tests for auth method * update migration ids * hide auth method on user creation form * (docs): Added documentation for the new authentication method * update migration * add to auto-form instead of having hidden fields
This commit is contained in:
@@ -2,6 +2,7 @@ from fastapi import HTTPException, status
|
||||
from sqlalchemy.orm.session import Session
|
||||
|
||||
from mealie.core.security import hash_password, url_safe_token
|
||||
from mealie.db.models.users.users import AuthMethod
|
||||
from mealie.repos.all_repositories import get_repositories
|
||||
from mealie.schema.user.user_passwords import SavePasswordResetToken
|
||||
from mealie.services._base_service import BaseService
|
||||
@@ -20,6 +21,9 @@ class PasswordResetService(BaseService):
|
||||
self.logger.error(f"failed to create password reset for {email=}: user doesn't exists")
|
||||
# Do not raise exception here as we don't want to confirm to the client that the Email doesn't exists
|
||||
return None
|
||||
elif user.password == "LDAP" or user.auth_method == AuthMethod.LDAP:
|
||||
self.logger.error(f"failed to create password reset for {email=}: user controlled by LDAP")
|
||||
return None
|
||||
|
||||
# Create Reset Token
|
||||
token = url_safe_token()
|
||||
|
||||
Reference in New Issue
Block a user