-
-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from MasoniteFramework/develop
Next Version - v1.3
- Loading branch information
Showing
23 changed files
with
128 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
''' Class for the authentication middleware ''' | ||
''' Authentication Middleware ''' | ||
|
||
class AuthenticationMiddleware(object): | ||
''' Middleware class which loads the current user into the request ''' | ||
''' Middleware To Check If The User Is Logged In ''' | ||
|
||
def __init__(self, request): | ||
self.request = request | ||
def __init__(self, Request): | ||
''' Inject Any Dependencies From The Service Container ''' | ||
self.request = Request | ||
|
||
def before(self): | ||
''' Register as a before middleware to be ran before the request ''' | ||
''' Run This Middleware Before The Route Executes ''' | ||
if not self.request.user(): | ||
self.request.redirectTo('login') | ||
|
||
def after(self): | ||
''' Run This Middleware After The Route Executes ''' | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.