How to use the masonite.facades.Auth.Auth function in masonite

To help you get started, we’ve selected a few masonite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MasoniteFramework / masonite / kernal / auth / controllers / LoginController.py View on Github external
def show(self, request):
        ''' Return the login page '''
        return view('auth/login', {'app': application, 'Auth': Auth(request)})
github MasoniteFramework / masonite / kernal / auth / controllers / RegisterController.py View on Github external
def show(self, request):
        ''' Show the registration page '''
        return view('auth/register', {'app': application, 'Auth': Auth(request)})
github MasoniteFramework / masonite / kernal / auth / controllers / LoginController.py View on Github external
def store(self, request):
        if Auth(request).login(request.input('username'), request.input('password')):
            request.redirect('/home')
        else:
            request.redirect('/login')
        return 'check terminal'
github MasoniteFramework / masonite / kernal / auth / controllers / RegisterController.py View on Github external
def store(self, request):
        ''' Register a new user '''

        # register the user
        auth.AUTH['model'].create(
            name=request.input('name'),
            password=request.input('password'),
            email=request.input('email'),
        )

        # login the user
        # redirect to the homepage
        if Auth(request).login(request.input('name'), request.input('password')):
            return request.redirect('/home')

        return request.redirect('/register')
github nioperas06 / masonite-forum / app / http / controllers / LoginController.py View on Github external
def show(self, Request, Application):
        ''' Show the login page '''
        return view('auth/login', {'app': Application, 'Auth': Auth(Request)})
github tipresias / tipresias / app / http / middleware / LoadUserMiddleware.py View on Github external
def load_user(self, request):
        ''' Load user into the request '''
        request.set_user(Auth(request).user())
github MasoniteFramework / masonite / kernal / auth / controllers / HomeController.py View on Github external
def show(self, request):
        if not Auth(request).user():
            request.redirect('/login')
        return view('auth/home', {'app': application, 'Auth': Auth(request)})
github nioperas06 / masonite-forum / app / http / controllers / LoginController.py View on Github external
def store(self, Request, Session):
        if Auth(Request).login(Request.input('email'), Request.input('password')):
            Session.flash('success', 'Logged successfuly!')
            return Request.redirect('/')
        else:
            Session.flash('login_error', 'These credentials do not match our records.')
            return Request.redirect('/login')
github MasoniteFramework / masonite / kernal / auth / controllers / LoginController.py View on Github external
def logout(self, request):
        Auth(request).logout()
        return request.redirect('/login')