2018-06-05 21:02:53 +02:00
|
|
|
import { Component } from '@angular/core';
|
2018-07-13 16:51:52 +02:00
|
|
|
import {
|
|
|
|
ActivatedRoute,
|
|
|
|
Router,
|
|
|
|
} from '@angular/router';
|
2018-06-05 21:02:53 +02:00
|
|
|
|
|
|
|
import { ApiService } from 'jslib/abstractions/api.service';
|
|
|
|
import { AuthService } from 'jslib/abstractions/auth.service';
|
|
|
|
import { CryptoService } from 'jslib/abstractions/crypto.service';
|
|
|
|
import { I18nService } from 'jslib/abstractions/i18n.service';
|
2018-11-13 04:54:40 +01:00
|
|
|
import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service';
|
2018-07-25 19:59:55 +02:00
|
|
|
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
2018-07-13 17:09:24 +02:00
|
|
|
import { StateService } from 'jslib/abstractions/state.service';
|
2018-06-05 21:02:53 +02:00
|
|
|
|
|
|
|
import { RegisterComponent as BaseRegisterComponent } from 'jslib/angular/components/register.component';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-register',
|
|
|
|
templateUrl: 'register.component.html',
|
|
|
|
})
|
|
|
|
export class RegisterComponent extends BaseRegisterComponent {
|
2018-07-20 16:29:40 +02:00
|
|
|
showCreateOrgMessage = false;
|
2018-07-25 19:59:55 +02:00
|
|
|
showTerms = true;
|
2018-07-20 16:29:40 +02:00
|
|
|
|
2018-06-05 21:02:53 +02:00
|
|
|
constructor(authService: AuthService, router: Router,
|
|
|
|
i18nService: I18nService, cryptoService: CryptoService,
|
2018-07-13 17:09:24 +02:00
|
|
|
apiService: ApiService, private route: ActivatedRoute,
|
2018-11-13 04:54:40 +01:00
|
|
|
stateService: StateService, platformUtilsService: PlatformUtilsService,
|
|
|
|
passwordGenerationService: PasswordGenerationService) {
|
|
|
|
super(authService, router, i18nService, cryptoService, apiService, stateService, platformUtilsService,
|
|
|
|
passwordGenerationService);
|
2018-07-25 19:59:55 +02:00
|
|
|
this.showTerms = !platformUtilsService.isSelfHost();
|
2018-06-05 21:02:53 +02:00
|
|
|
}
|
2018-07-13 16:51:52 +02:00
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.route.queryParams.subscribe((qParams) => {
|
|
|
|
if (qParams.email != null && qParams.email.indexOf('@') > -1) {
|
|
|
|
this.email = qParams.email;
|
|
|
|
}
|
2018-07-20 16:29:40 +02:00
|
|
|
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 } });
|
|
|
|
}
|
2018-07-13 16:51:52 +02:00
|
|
|
});
|
|
|
|
}
|
2018-06-05 21:02:53 +02:00
|
|
|
}
|