Compare commits

...

3 Commits

2 changed files with 4 additions and 2 deletions

View File

@ -343,7 +343,7 @@ to ask the user for the username and password again.
Log In Bookkeeping Log In Bookkeeping
=================# ==================
You can register a callback to run when the user logs in, for ex., You can register a callback to run when the user logs in, for ex.,
logging the log in event, adding the log in counter, etc. logging the log in event, adding the log in counter, etc.
@ -402,6 +402,7 @@ Copyright
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
Authors Authors
======= =======

View File

@ -110,7 +110,7 @@ class DigestAuth:
class NoLogInException(Exception): class NoLogInException(Exception):
"""The exception thrown when the user is not authorized.""" """The exception thrown when the user is not authorized."""
def get_logged_in_user() -> t.Optional[t.Any]: def get_logged_in_user() -> t.Any:
"""Returns the currently logged-in user. """Returns the currently logged-in user.
:return: The currently logged-in user. :return: The currently logged-in user.
@ -120,6 +120,7 @@ class DigestAuth:
raise NoLogInException raise NoLogInException
user: t.Optional[t.Any] = self.__get_user(session["user"]) user: t.Optional[t.Any] = self.__get_user(session["user"])
if user is None: if user is None:
del session["user"]
raise NoLogInException raise NoLogInException
return user return user