mirror of
https://github.com/bitwarden/browser.git
synced 2024-07-22 14:56:53 +02:00
load policies on register if org invite (#475)
This commit is contained in:
parent
aac011d3b3
commit
c9699647d7
2
jslib
2
jslib
|
@ -1 +1 @@
|
||||||
Subproject commit e93c534ec4f724eaa8b494f516b187bea67b132c
|
Subproject commit 4aecc53ddef892d22457cf32b4f8d140c9253688
|
|
@ -14,6 +14,10 @@ import { StateService } from 'jslib/abstractions/state.service';
|
||||||
|
|
||||||
import { RegisterComponent as BaseRegisterComponent } from 'jslib/angular/components/register.component';
|
import { RegisterComponent as BaseRegisterComponent } from 'jslib/angular/components/register.component';
|
||||||
|
|
||||||
|
import { Policy } from 'jslib/models/domain/policy';
|
||||||
|
|
||||||
|
import { PolicyData } from 'jslib/models/data/policyData';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-register',
|
selector: 'app-register',
|
||||||
templateUrl: 'register.component.html',
|
templateUrl: 'register.component.html',
|
||||||
|
@ -22,6 +26,8 @@ export class RegisterComponent extends BaseRegisterComponent {
|
||||||
showCreateOrgMessage = false;
|
showCreateOrgMessage = false;
|
||||||
showTerms = true;
|
showTerms = true;
|
||||||
|
|
||||||
|
private policies: Policy[];
|
||||||
|
|
||||||
constructor(authService: AuthService, router: Router,
|
constructor(authService: AuthService, router: Router,
|
||||||
i18nService: I18nService, cryptoService: CryptoService,
|
i18nService: I18nService, cryptoService: CryptoService,
|
||||||
apiService: ApiService, private route: ActivatedRoute,
|
apiService: ApiService, private route: ActivatedRoute,
|
||||||
|
@ -32,7 +38,7 @@ export class RegisterComponent extends BaseRegisterComponent {
|
||||||
this.showTerms = !platformUtilsService.isSelfHost();
|
this.showTerms = !platformUtilsService.isSelfHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
async ngOnInit() {
|
||||||
const queryParamsSub = this.route.queryParams.subscribe((qParams) => {
|
const queryParamsSub = this.route.queryParams.subscribe((qParams) => {
|
||||||
if (qParams.email != null && qParams.email.indexOf('@') > -1) {
|
if (qParams.email != null && qParams.email.indexOf('@') > -1) {
|
||||||
this.email = qParams.email;
|
this.email = qParams.email;
|
||||||
|
@ -48,5 +54,16 @@ export class RegisterComponent extends BaseRegisterComponent {
|
||||||
queryParamsSub.unsubscribe();
|
queryParamsSub.unsubscribe();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
const invite = await this.stateService.get<any>('orgInvitation');
|
||||||
|
if (invite != null) {
|
||||||
|
try {
|
||||||
|
const policies = await this.apiService.getPoliciesByToken(invite.organizationId, invite.token,
|
||||||
|
invite.email, invite.organizationUserId);
|
||||||
|
if (policies.data != null) {
|
||||||
|
const policiesData = policies.data.map((p) => new PolicyData(p));
|
||||||
|
this.policies = policiesData.map((p) => new Policy(p));
|
||||||
|
}
|
||||||
|
} catch { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user