1
0
mirror of https://github.com/bitwarden/web synced 2025-12-11 05:43:16 +00:00

org invite accept flow on login/register

This commit is contained in:
Kyle Spearrin
2018-07-13 10:51:52 -04:00
parent a1495a8f0c
commit 3cfe8bf751
7 changed files with 47 additions and 21 deletions

View File

@@ -21,7 +21,7 @@ import { AuthService } from 'jslib/abstractions/auth.service';
import { EnvironmentService } from 'jslib/abstractions/environment.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { SyncService } from 'jslib/abstractions/sync.service';
import { StateService } from 'jslib/abstractions/state.service';
import { TwoFactorComponent as BaseTwoFactorComponent } from 'jslib/angular/components/two-factor.component';
@@ -35,10 +35,11 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
constructor(authService: AuthService, router: Router,
analytics: Angulartics2, toasterService: ToasterService,
i18nService: I18nService, apiService: ApiService,
platformUtilsService: PlatformUtilsService, private syncService: SyncService,
platformUtilsService: PlatformUtilsService, private stateService: StateService,
environmentService: EnvironmentService, private componentFactoryResolver: ComponentFactoryResolver) {
super(authService, router, analytics, toasterService, i18nService, apiService,
platformUtilsService, window, environmentService);
this.onSuccessfulLoginNavigate = this.goAfterLogIn;
}
anotherMethod() {
@@ -56,4 +57,13 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
modal.close();
});
}
async goAfterLogIn() {
const invite = await this.stateService.get<any>('orgInvitation');
if (invite != null) {
this.router.navigate(['accept-organization'], { queryParams: invite });
} else {
this.router.navigate([this.successRoute]);
}
}
}