diff --git a/npm/ng-packs/packages/account/src/lib/components/login/login.component.html b/npm/ng-packs/packages/account/src/lib/components/login/login.component.html
index 170db44a8e..0b8f12b20c 100644
--- a/npm/ng-packs/packages/account/src/lib/components/login/login.component.html
+++ b/npm/ng-packs/packages/account/src/lib/components/login/login.component.html
@@ -28,9 +28,9 @@
diff --git a/npm/ng-packs/packages/account/src/lib/components/register/register.component.html b/npm/ng-packs/packages/account/src/lib/components/register/register.component.html
index b834d9c6c4..43ef7e2aaa 100644
--- a/npm/ng-packs/packages/account/src/lib/components/register/register.component.html
+++ b/npm/ng-packs/packages/account/src/lib/components/register/register.component.html
@@ -18,9 +18,9 @@
*
-
{{ 'AbpAccount::Login' | abpLocalization }}
diff --git a/npm/ng-packs/packages/account/src/lib/components/register/register.component.ts b/npm/ng-packs/packages/account/src/lib/components/register/register.component.ts
index 8b47ed16a9..e70bc35b7f 100644
--- a/npm/ng-packs/packages/account/src/lib/components/register/register.component.ts
+++ b/npm/ng-packs/packages/account/src/lib/components/register/register.component.ts
@@ -1,8 +1,12 @@
+import { ConfigState, GetAppConfiguration } from '@abp/ng.core';
import { ToasterService } from '@abp/ng.theme.shared';
import { Component } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
-import { throwError } from 'rxjs';
-import { catchError, finalize, take } from 'rxjs/operators';
+import { Navigate } from '@ngxs/router-plugin';
+import { Store } from '@ngxs/store';
+import { OAuthService } from 'angular-oauth2-oidc';
+import { from, throwError } from 'rxjs';
+import { catchError, finalize, switchMap, take, tap } from 'rxjs/operators';
import snq from 'snq';
import { RegisterRequest } from '../../models';
import { AccountService } from '../../services/account.service';
@@ -17,7 +21,16 @@ export class RegisterComponent {
inProgress: boolean;
- constructor(private fb: FormBuilder, private accountService: AccountService, private toasterService: ToasterService) {
+ constructor(
+ private fb: FormBuilder,
+ private accountService: AccountService,
+ private oauthService: OAuthService,
+ private store: Store,
+ private toasterService: ToasterService,
+ ) {
+ this.oauthService.configure(this.store.selectSnapshot(ConfigState.getOne('environment')).oAuthConfig);
+ this.oauthService.loadDiscoveryDocument();
+
this.form = this.fb.group({
username: ['', [required, maxLength(255)]],
password: ['', [required, maxLength(32)]],
@@ -40,6 +53,9 @@ export class RegisterComponent {
this.accountService
.register(newUser)
.pipe(
+ switchMap(() => from(this.oauthService.fetchTokenUsingPasswordFlow(newUser.userName, newUser.password))),
+ switchMap(() => this.store.dispatch(new GetAppConfiguration())),
+ tap(() => this.store.dispatch(new Navigate(['/']))),
take(1),
catchError(err => {
this.toasterService.error(
diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts
index 3fdf506a1c..0196ad19ec 100644
--- a/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts
+++ b/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts
@@ -3,7 +3,7 @@ import { Component, Input } from '@angular/core';
@Component({
selector: 'abp-button',
template: `
-