Fixed: /login /register redirect if logged in

This commit is contained in:
Sagi Dayan 2020-05-09 22:15:24 -04:00
parent ca38ba0bb4
commit 85f73ab139

View file

@ -1,11 +1,19 @@
'use strict' 'use strict'
const User = use('App/Models/User') const User = use('App/Models/User')
class AuthController { class AuthController {
async registerIndex({view}) { async registerIndex({view, auth, response}) {
if (auth.user) {
response.redirect('/');
return;
}
return view.render('register') return view.render('register')
} }
async loginIndex({view}) { async loginIndex({view, auth, response}) {
if (auth.user) {
response.redirect('/');
return;
}
return view.render('login') return view.render('login')
} }