CoreID/app/routing/routers/auth/forms.routes.js

132 lines
4.6 KiB
JavaScript
Raw Normal View History

2020-04-17 00:59:48 +00:00
/*
* Auth Form Routes
* -------------------------------------------------------------
* The routes here pertain to auth forms like register/login etc.
* The general structure is as follows:
*
* /auth/{provider name}/{action}
2020-04-22 21:56:39 +00:00
*
2020-04-17 00:59:48 +00:00
* Individual providers may be interacted with individually, therefore:
*
* /auth/flitter/register
*
* You can omit the provider name to use the default provider:
*
* /auth/register
*/
const index = {
prefix: '/auth',
middleware: [
],
get: {
'/:provider/register': [
2020-05-20 14:56:03 +00:00
['middleware::util:Setting', { key: 'auth.allow_registration' }],
2020-04-17 00:59:48 +00:00
'middleware::auth:ProviderRoute',
'middleware::auth:GuestOnly',
'middleware::auth:ProviderRegistrationEnabled',
'controller::auth:Forms.registration_provider_get',
],
'/register': [
2020-05-20 14:56:03 +00:00
['middleware::util:Setting', { key: 'auth.allow_registration' }],
2020-04-17 00:59:48 +00:00
'middleware::auth:ProviderRoute',
'middleware::auth:GuestOnly',
'middleware::auth:ProviderRegistrationEnabled',
'controller::auth:Forms.registration_provider_get',
],
'/:provider/login': [
'middleware::auth:ProviderRoute',
'middleware::auth:GuestOnly',
'controller::auth:Forms.login_provider_get',
],
'/login': [
'middleware::auth:ProviderRoute',
'middleware::auth:GuestOnly',
'controller::auth:Forms.login_provider_get',
],
'/:provider/logout': [
'middleware::auth:ProviderRoute',
'middleware::auth:UserOnly',
2020-04-17 00:59:48 +00:00
'controller::auth:Forms.logout_provider_clean_session',
// Note, this separation is between when the auth action has happened properly
// and before the user is allowed to continue. You can use it to add your own
// custom middleware for auth flow handling.
'controller::auth:Forms.logout_provider_present_success',
],
'/logout': [
'middleware::auth:ProviderRoute',
'middleware::auth:UserOnly',
2020-04-17 00:59:48 +00:00
'controller::auth:Forms.logout_provider_clean_session',
'controller::auth:Forms.logout_provider_present_success',
],
'/finish-registration': [
'middleware::auth:UserOnly',
'controller::auth:Forms.finish_registration',
],
'/login-message': [
'middleware::auth:UserOnly',
'controller::api:v1:System.show_login_message',
],
'/login-message/dismiss': [
'middleware::auth:UserOnly',
'controller::api:v1:System.dismiss_login_message',
],
2020-04-17 00:59:48 +00:00
},
post: {
2020-05-20 14:56:03 +00:00
/*'/:provider/register': [
['middleware::util:Setting', { key: 'auth.allow_registration' }],
2020-04-17 00:59:48 +00:00
'middleware::auth:ProviderRoute',
'middleware::auth:GuestOnly',
'middleware::auth:ProviderRegistrationEnabled',
'controller::auth:Forms.registration_provider_create_user',
'controller::auth:Forms.registration_provider_present_user_created',
],
'/register': [
2020-05-20 14:56:03 +00:00
['middleware::util:Setting', { key: 'auth.allow_registration' }],
2020-04-17 00:59:48 +00:00
'middleware::auth:ProviderRoute',
'middleware::auth:GuestOnly',
'middleware::auth:ProviderRegistrationEnabled',
'controller::auth:Forms.registration_provider_create_user',
'controller::auth:Forms.registration_provider_present_user_created',
2020-05-20 14:56:03 +00:00
],*/
2020-04-17 00:59:48 +00:00
'/:provider/login': [
'middleware::auth:ProviderRoute',
'middleware::auth:GuestOnly',
'controller::auth:Forms.login_provider_authenticate_user',
'controller::auth:Forms.login_provider_present_success',
],
'/login': [
'middleware::auth:ProviderRoute',
'middleware::auth:GuestOnly',
'controller::auth:Forms.login_provider_authenticate_user',
'controller::auth:Forms.login_provider_present_success',
],
'/:provider/logout': [
'middleware::auth:ProviderRoute',
'middleware::auth:UserOnly',
2020-04-17 00:59:48 +00:00
'controller::auth:Forms.logout_provider_clean_session',
'controller::auth:Forms.logout_provider_present_success',
],
'/logout': [
'middleware::auth:ProviderRoute',
'middleware::auth:UserOnly',
2020-04-17 00:59:48 +00:00
'controller::auth:Forms.logout_provider_clean_session',
'controller::auth:Forms.logout_provider_present_success',
],
},
}
module.exports = exports = index