3
0
Fork 0

fix: add dedicated authenticate_user() method for auth view

in case subclass needs to tweak that behavior
This commit is contained in:
Lance Edgar 2026-02-03 20:27:47 -06:00
parent 204548e4f2
commit b410b5aa02

View file

@ -2,7 +2,7 @@
################################################################################
#
# wuttaweb -- Web App for Wutta Framework
# Copyright © 2024-2025 Lance Edgar
# Copyright © 2024-2026 Lance Edgar
#
# This file is part of Wutta Framework.
#
@ -49,7 +49,6 @@ class AuthView(View):
"""
model = self.app.model
session = session or Session()
auth = self.app.get_auth_handler()
# nb. redirect to /setup if no users exist
user = session.query(model.User).first()
@ -79,8 +78,9 @@ class AuthView(View):
if data:
# truly validate user credentials
user = auth.authenticate_user(session, data["username"], data["password"])
if user:
if user := self.authenticate_user(
session, data["username"], data["password"]
):
# okay now they're truly logged in
headers = login_user(self.request, user)
@ -95,6 +95,12 @@ class AuthView(View):
# 'referrer': referrer,
}
def authenticate_user(
self, session, username, password
): # pylint: disable=missing-function-docstring
auth = self.app.get_auth_handler()
return auth.authenticate_user(session, username, password)
def login_make_schema(self): # pylint: disable=empty-docstring
""" """
schema = colander.Schema()