You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CoreID/app/controllers/auth/Forms.controller.js

39 lines
1.2 KiB

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 {
static get services() {
return [...super.services, 'Vue', 'models']
}
async registration_provider_get(req, res, next) {
return res.page('auth:register', {
...this.Vue.data({})
})
}
async login_provider_get(req, res, next) {
const Setting = this.models.get('Setting')
return res.page('auth:login', {
...this.Vue.data({
login_message: req.session?.auth?.message || 'Please sign-in to continue.',
registration_enabled: await Setting.get('auth.allow_registration')
}),
})
}
async logout_provider_present_success(req, res, next) {
return this.Vue.auth_message(res, {
message: 'You have been successfully logged out.',
next_destination: '/',
})
}
}
module.exports = exports = Forms