-
-
Couldn't load subscription status.
- Fork 132
Open
Labels
Description
Describe the bug
The function auth.attempt() should return the user model when the parameter once is set to True, but currently, it returns None instead.
Expected behaviour
auth.attempt() must return the user model when the credentials are valid whether the once parameter is set or not.
Steps to reproduce the bug
user = auth.attempt(request.input("email"), request.input("password"), once=True)
if user: # user is always None
print(user.id)Masonite Version
4.20.0
Anything else ?
the Default WebGuard's attempt method can be rewritten to something like this:
masonite.authentication.guards.WebGuard.py
def attempt(self, username, password):
attempt = self.options.get("model")().attempt(username, password)
if attempt and not self.options.get("once"):
self.application.make("response").cookie("token", attempt.remember_token)
self.application.make("request").set_user(attempt)
return attempt # change this line