mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-04 18:37:45 +01:00
handle redirect params for create org/premium
This commit is contained in:
parent
a5246df3ed
commit
b99df5905f
@ -32,6 +32,12 @@ export class LoginComponent extends BaseLoginComponent {
|
|||||||
if (qParams.email != null && qParams.email.indexOf('@') > -1) {
|
if (qParams.email != null && qParams.email.indexOf('@') > -1) {
|
||||||
this.email = qParams.email;
|
this.email = qParams.email;
|
||||||
}
|
}
|
||||||
|
if (qParams.premium != null) {
|
||||||
|
this.stateService.save('loginRedirect', { route: '/settings/premium' });
|
||||||
|
} else if (qParams.org != null) {
|
||||||
|
this.stateService.save('loginRedirect',
|
||||||
|
{ route: '/settings/create-organization', qParams: { plan: qParams.org } });
|
||||||
|
}
|
||||||
await super.ngOnInit();
|
await super.ngOnInit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -41,7 +47,13 @@ export class LoginComponent extends BaseLoginComponent {
|
|||||||
if (invite != null) {
|
if (invite != null) {
|
||||||
this.router.navigate(['accept-organization'], { queryParams: invite });
|
this.router.navigate(['accept-organization'], { queryParams: invite });
|
||||||
} else {
|
} else {
|
||||||
this.router.navigate([this.successRoute]);
|
const loginRedirect = await this.stateService.get<any>('loginRedirect');
|
||||||
|
if (loginRedirect != null) {
|
||||||
|
this.router.navigate([loginRedirect.route], { queryParams: loginRedirect.qParams });
|
||||||
|
await this.stateService.remove('loginRedirect');
|
||||||
|
} else {
|
||||||
|
this.router.navigate([this.successRoute]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
<p class="lead text-center mb-4">{{'createAccount' | i18n}}</p>
|
<p class="lead text-center mb-4">{{'createAccount' | i18n}}</p>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
<app-callout title="{{'createOrganizationStep1' | i18n}}" type="info" icon="fa-thumb-tack" *ngIf="showCreateOrgMessage">
|
||||||
|
{{'createOrganizationCreatePersonalAccount' | i18n}}
|
||||||
|
</app-callout>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="email">{{'emailAddress' | i18n}}</label>
|
<label for="email">{{'emailAddress' | i18n}}</label>
|
||||||
<input id="email" class="form-control" type="text" name="Email" [(ngModel)]="email" required [appAutofocus]="email === ''"
|
<input id="email" class="form-control" type="text" name="Email" [(ngModel)]="email" required [appAutofocus]="email === ''"
|
||||||
|
@ -20,6 +20,8 @@ import { RegisterComponent as BaseRegisterComponent } from 'jslib/angular/compon
|
|||||||
templateUrl: 'register.component.html',
|
templateUrl: 'register.component.html',
|
||||||
})
|
})
|
||||||
export class RegisterComponent extends BaseRegisterComponent {
|
export class RegisterComponent extends BaseRegisterComponent {
|
||||||
|
showCreateOrgMessage = false;
|
||||||
|
|
||||||
constructor(authService: AuthService, router: Router,
|
constructor(authService: AuthService, router: Router,
|
||||||
analytics: Angulartics2, toasterService: ToasterService,
|
analytics: Angulartics2, toasterService: ToasterService,
|
||||||
i18nService: I18nService, cryptoService: CryptoService,
|
i18nService: I18nService, cryptoService: CryptoService,
|
||||||
@ -33,6 +35,13 @@ export class RegisterComponent extends BaseRegisterComponent {
|
|||||||
if (qParams.email != null && qParams.email.indexOf('@') > -1) {
|
if (qParams.email != null && qParams.email.indexOf('@') > -1) {
|
||||||
this.email = qParams.email;
|
this.email = qParams.email;
|
||||||
}
|
}
|
||||||
|
if (qParams.premium != null) {
|
||||||
|
this.stateService.save('loginRedirect', { route: '/settings/premium' });
|
||||||
|
} else if (qParams.org != null) {
|
||||||
|
this.showCreateOrgMessage = true;
|
||||||
|
this.stateService.save('loginRedirect',
|
||||||
|
{ route: '/settings/create-organization', qParams: { plan: qParams.org } });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,13 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
|
|||||||
if (invite != null) {
|
if (invite != null) {
|
||||||
this.router.navigate(['accept-organization'], { queryParams: invite });
|
this.router.navigate(['accept-organization'], { queryParams: invite });
|
||||||
} else {
|
} else {
|
||||||
this.router.navigate([this.successRoute]);
|
const loginRedirect = await this.stateService.get<any>('loginRedirect');
|
||||||
|
if (loginRedirect != null) {
|
||||||
|
this.router.navigate([loginRedirect.route], { queryParams: loginRedirect.qParams });
|
||||||
|
await this.stateService.remove('loginRedirect');
|
||||||
|
} else {
|
||||||
|
this.router.navigate([this.successRoute]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
EventEmitter,
|
OnInit,
|
||||||
Output,
|
|
||||||
ViewChild,
|
ViewChild,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
import {
|
||||||
import { Router } from '@angular/router';
|
ActivatedRoute,
|
||||||
|
Router,
|
||||||
|
} from '@angular/router';
|
||||||
|
|
||||||
import { ToasterService } from 'angular2-toaster';
|
import { ToasterService } from 'angular2-toaster';
|
||||||
import { Angulartics2 } from 'angulartics2';
|
import { Angulartics2 } from 'angulartics2';
|
||||||
@ -25,7 +26,7 @@ import { OrganizationCreateRequest } from 'jslib/models/request/organizationCrea
|
|||||||
selector: 'app-create-organization',
|
selector: 'app-create-organization',
|
||||||
templateUrl: 'create-organization.component.html',
|
templateUrl: 'create-organization.component.html',
|
||||||
})
|
})
|
||||||
export class CreateOrganizationComponent {
|
export class CreateOrganizationComponent implements OnInit {
|
||||||
@ViewChild(PaymentComponent) paymentComponent: PaymentComponent;
|
@ViewChild(PaymentComponent) paymentComponent: PaymentComponent;
|
||||||
|
|
||||||
selfHosted = false;
|
selfHosted = false;
|
||||||
@ -83,10 +84,19 @@ export class CreateOrganizationComponent {
|
|||||||
constructor(private apiService: ApiService, private i18nService: I18nService,
|
constructor(private apiService: ApiService, private i18nService: I18nService,
|
||||||
private analytics: Angulartics2, private toasterService: ToasterService,
|
private analytics: Angulartics2, private toasterService: ToasterService,
|
||||||
platformUtilsService: PlatformUtilsService, private cryptoService: CryptoService,
|
platformUtilsService: PlatformUtilsService, private cryptoService: CryptoService,
|
||||||
private router: Router, private syncService: SyncService) {
|
private router: Router, private syncService: SyncService,
|
||||||
|
private route: ActivatedRoute) {
|
||||||
this.selfHosted = platformUtilsService.isSelfHost();
|
this.selfHosted = platformUtilsService.isSelfHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.route.queryParams.subscribe(async (qParams) => {
|
||||||
|
if (qParams.plan === 'families' || qParams.plan === 'teams' || qParams.plan === 'enterprise') {
|
||||||
|
this.plan = qParams.plan;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
let files: FileList = null;
|
let files: FileList = null;
|
||||||
if (this.selfHosted) {
|
if (this.selfHosted) {
|
||||||
|
@ -2325,5 +2325,11 @@
|
|||||||
},
|
},
|
||||||
"upgradeOrganizationDesc": {
|
"upgradeOrganizationDesc": {
|
||||||
"message": "This feature is not available for free organizations. Switch to a paid plan to unlock more features."
|
"message": "This feature is not available for free organizations. Switch to a paid plan to unlock more features."
|
||||||
|
},
|
||||||
|
"createOrganizationStep1": {
|
||||||
|
"message": "Create Organization: Step 1"
|
||||||
|
},
|
||||||
|
"createOrganizationCreatePersonalAccount": {
|
||||||
|
"message": "Before creating your organization, you first need to create a free personal account."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user