Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def show(self, request):
''' Return the login page '''
return view('auth/login', {'app': application, 'Auth': Auth(request)})
def show(self, request):
''' Show the registration page '''
return view('auth/register', {'app': application, 'Auth': Auth(request)})
def store(self, request):
if Auth(request).login(request.input('username'), request.input('password')):
request.redirect('/home')
else:
request.redirect('/login')
return 'check terminal'
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')
def show(self, Request, Application):
''' Show the login page '''
return view('auth/login', {'app': Application, 'Auth': Auth(Request)})
def load_user(self, request):
''' Load user into the request '''
request.set_user(Auth(request).user())
def show(self, request):
if not Auth(request).user():
request.redirect('/login')
return view('auth/home', {'app': application, 'Auth': Auth(request)})
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')
def logout(self, request):
Auth(request).logout()
return request.redirect('/login')