+
+ private doRedirect (redirectUrl: string, fallbackRoute?: string) {
+ logger('Redirecting on %s', redirectUrl)
+
+ if (this.isValidRedirection(redirectUrl)) {
+ return this.router.navigateByUrl(redirectUrl)
+ }
+
+ logger('%s is not a valid redirection, try fallback route %s', redirectUrl, fallbackRoute)
+ if (fallbackRoute) {
+ return this.router.navigateByUrl(fallbackRoute)
+ }
+
+ logger('There was no fallback route, redirecting to homepage')
+ return this.redirectToHomepage()
+ }
+
+ private isValidRedirection (redirectUrl: string) {
+ const exceptions = [
+ '/verify-account',
+ '/reset-password',
+ '/login'
+ ]
+
+ if (!redirectUrl || redirectUrl === '/') return false
+
+ return exceptions.every(e => !redirectUrl.startsWith(e))
+ }