2020-04-17 00:59:48 +00:00
|
|
|
const FormController = require('flitter-auth/controllers/Forms')
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Handles views and processing for auth registration/login/logout/etc.
|
|
|
|
* Most handlers are inherited from the default flitter-auth/controllers/Forms
|
|
|
|
* controller, however you can override them here as you need.
|
|
|
|
*/
|
|
|
|
class Forms extends FormController {
|
2020-04-22 14:19:25 +00:00
|
|
|
static get services() {
|
2020-05-20 14:56:03 +00:00
|
|
|
return [...super.services, 'Vue', 'models']
|
|
|
|
}
|
|
|
|
|
|
|
|
async registration_provider_get(req, res, next) {
|
|
|
|
return res.page('auth:register', {
|
|
|
|
...this.Vue.data({})
|
|
|
|
})
|
2020-04-22 14:19:25 +00:00
|
|
|
}
|
2020-04-17 00:59:48 +00:00
|
|
|
|
2020-04-22 14:19:25 +00:00
|
|
|
async login_provider_get(req, res, next) {
|
2020-05-20 14:56:03 +00:00
|
|
|
const Setting = this.models.get('Setting')
|
|
|
|
|
2020-04-22 14:19:25 +00:00
|
|
|
return res.page('auth:login', {
|
|
|
|
...this.Vue.data({
|
2020-05-20 14:56:03 +00:00
|
|
|
login_message: req.session?.auth?.message || 'Please sign-in to continue.',
|
|
|
|
registration_enabled: await Setting.get('auth.allow_registration')
|
2020-04-22 14:19:25 +00:00
|
|
|
}),
|
|
|
|
})
|
|
|
|
}
|
2020-04-22 21:56:39 +00:00
|
|
|
|
|
|
|
async logout_provider_present_success(req, res, next) {
|
|
|
|
return this.Vue.auth_message(res, {
|
|
|
|
message: 'You have been successfully logged out.',
|
|
|
|
next_destination: '/',
|
|
|
|
})
|
|
|
|
}
|
2020-04-17 00:59:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = exports = Forms
|