mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-20 02:01:47 +01:00
add org invite token to registration if present
This commit is contained in:
parent
a949f499ac
commit
9bc7459eac
@ -10,6 +10,7 @@ import { ApiService } from '../../abstractions/api.service';
|
|||||||
import { AuthService } from '../../abstractions/auth.service';
|
import { AuthService } from '../../abstractions/auth.service';
|
||||||
import { CryptoService } from '../../abstractions/crypto.service';
|
import { CryptoService } from '../../abstractions/crypto.service';
|
||||||
import { I18nService } from '../../abstractions/i18n.service';
|
import { I18nService } from '../../abstractions/i18n.service';
|
||||||
|
import { StateService } from '../../abstractions/state.service';
|
||||||
|
|
||||||
export class RegisterComponent {
|
export class RegisterComponent {
|
||||||
name: string = '';
|
name: string = '';
|
||||||
@ -25,7 +26,7 @@ export class RegisterComponent {
|
|||||||
constructor(protected authService: AuthService, protected router: Router,
|
constructor(protected authService: AuthService, protected router: Router,
|
||||||
protected analytics: Angulartics2, protected toasterService: ToasterService,
|
protected analytics: Angulartics2, protected toasterService: ToasterService,
|
||||||
protected i18nService: I18nService, protected cryptoService: CryptoService,
|
protected i18nService: I18nService, protected cryptoService: CryptoService,
|
||||||
protected apiService: ApiService) { }
|
protected apiService: ApiService, protected stateService: StateService) { }
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
if (this.email == null || this.email === '') {
|
if (this.email == null || this.email === '') {
|
||||||
@ -63,6 +64,11 @@ export class RegisterComponent {
|
|||||||
const request = new RegisterRequest(this.email, this.name, hashedPassword,
|
const request = new RegisterRequest(this.email, this.name, hashedPassword,
|
||||||
this.hint, encKey[1].encryptedString);
|
this.hint, encKey[1].encryptedString);
|
||||||
request.keys = new KeysRequest(keys[0], keys[1].encryptedString);
|
request.keys = new KeysRequest(keys[0], keys[1].encryptedString);
|
||||||
|
const orgInvite = await this.stateService.get<any>('orgInvitation');
|
||||||
|
if (orgInvite != null && orgInvite.token != null && orgInvite.organizationUserId != null) {
|
||||||
|
request.token = orgInvite.token;
|
||||||
|
request.organizationUserId = orgInvite.organizationUserId;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.formPromise = this.apiService.postRegister(request);
|
this.formPromise = this.apiService.postRegister(request);
|
||||||
|
Loading…
Reference in New Issue
Block a user