Make registration carry flow all the way through
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details

master
Garrett Mills 3 years ago
parent 5bc98e6568
commit 9729de47f8
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

@ -90,6 +90,10 @@ class PasswordController extends Controller {
await this.activity.password_reset({ req, ip: req.ip }) await this.activity.password_reset({ req, ip: req.ip })
if ( req.trap.has_trap() && req.trap.get_trap() === 'password_reset' ) await req.trap.end() if ( req.trap.has_trap() && req.trap.get_trap() === 'password_reset' ) await req.trap.end()
if ( req.session.registrant_flow ) {
await req.trap.begin('registrant_flow', { session_only: true })
}
// invalidate existing tokens and other logins // invalidate existing tokens and other logins
await req.user.logout(req) await req.user.logout(req)
await req.user.kickout() await req.user.kickout()

@ -11,11 +11,21 @@ class Forms extends FormController {
} }
async registration_provider_get(req, res, next) { async registration_provider_get(req, res, next) {
if ( req.session.auth.flow ) {
req.session.registrant_flow = req.session.auth.flow
}
return res.page('auth:register', { return res.page('auth:register', {
...this.Vue.data({}) ...this.Vue.data({})
}) })
} }
async finish_registration(req, res, next) {
if ( req.trap.has_trap() && req.trap.get_trap() === 'registrant_flow' ) await req.trap.end()
const dest = req.session.registrant_flow || '/dash/profile'
return res.redirect(dest)
}
async login_provider_get(req, res, next) { async login_provider_get(req, res, next) {
const Setting = this.models.get('Setting') const Setting = this.models.get('Setting')

@ -67,6 +67,11 @@ const index = {
'controller::auth:Forms.logout_provider_present_success', 'controller::auth:Forms.logout_provider_present_success',
], ],
'/finish-registration': [
'middleware::auth:UserOnly',
'controller::auth:Forms.finish_registration',
],
'/login-message': [ '/login-message': [
'middleware::auth:UserOnly', 'middleware::auth:UserOnly',
'controller::api:v1:System.show_login_message', 'controller::api:v1:System.show_login_message',

@ -29,6 +29,18 @@ const traps_config = {
'/auth/login-message/dismiss', '/auth/login-message/dismiss',
], ],
}, },
registrant_flow: {
redirect_to: '/auth/finish-registration',
allowed_routes: [
'/auth/finish-registration',
'/auth/logout',
'/auth/login',
'/api/v1/locale/batch',
'/api/v1/auth/validate/username',
'/api/v1/auth/attempt',
'/api/v1/vault/get-trust-payload',
],
},
}, },
} }

Loading…
Cancel
Save