forked from sagi/seepur
Fixed: /login /register redirect if logged in
This commit is contained in:
parent
ca38ba0bb4
commit
85f73ab139
1 changed files with 10 additions and 2 deletions
|
@ -1,11 +1,19 @@
|
|||
'use strict'
|
||||
const User = use('App/Models/User')
|
||||
class AuthController {
|
||||
async registerIndex({view}) {
|
||||
async registerIndex({view, auth, response}) {
|
||||
if (auth.user) {
|
||||
response.redirect('/');
|
||||
return;
|
||||
}
|
||||
return view.render('register')
|
||||
}
|
||||
|
||||
async loginIndex({view}) {
|
||||
async loginIndex({view, auth, response}) {
|
||||
if (auth.user) {
|
||||
response.redirect('/');
|
||||
return;
|
||||
}
|
||||
return view.render('login')
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue