1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 09:13:33 +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

@@ -9,6 +9,7 @@ import { Angulartics2 } from 'angulartics2';
import { AuthService } from 'jslib/abstractions/auth.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { StateService } from 'jslib/abstractions/state.service';
import { StorageService } from 'jslib/abstractions/storage.service';
import { LoginComponent as BaseLoginComponent } from 'jslib/angular/components/login.component';
@@ -21,9 +22,9 @@ export class LoginComponent extends BaseLoginComponent {
constructor(authService: AuthService, router: Router,
analytics: Angulartics2, toasterService: ToasterService,
i18nService: I18nService, private route: ActivatedRoute,
storageService: StorageService) {
storageService: StorageService, private stateService: StateService) {
super(authService, router, analytics, toasterService, i18nService, storageService);
this.successRoute = '/vault';
this.onSuccessfulLoginNavigate = this.goAfterLogIn;
}
async ngOnInit() {
@@ -34,4 +35,13 @@ export class LoginComponent extends BaseLoginComponent {
await super.ngOnInit();
});
}
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]);
}
}
}