Commit c0463b92 authored by Revant Nandgaonkar's avatar Revant Nandgaonkar

fix(authorization-client): Signup Component

Message to check email on signup

improve signup UI
parent b13aba99
......@@ -6,6 +6,7 @@ import { FormsModule } from '@angular/forms';
import { AuthService } from '../auth/auth.service';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { RouterTestingModule } from '@angular/router/testing';
describe('SignupComponent', () => {
let fixture: ComponentFixture<SignupComponent>;
......@@ -26,6 +27,7 @@ describe('SignupComponent', () => {
FormsModule,
BrowserAnimationsModule,
HttpClientTestingModule,
RouterTestingModule,
],
}).compileComponents();
}));
......
......@@ -4,6 +4,8 @@ import { MatSnackBar } from '@angular/material';
import { SOMETHING_WENT_WRONG } from '../../constants/messages';
import { SignupService } from './signup.service';
import { ServerInfo } from '../../common/server-info.interface';
import { CLOSE, PLEASE_CHECK_EMAIL } from 'src/constants/app-strings';
import { Router } from '@angular/router';
@Component({
selector: 'app-signup',
......@@ -21,6 +23,7 @@ export class SignupComponent implements OnInit {
private authService: AuthService,
private snackBar: MatSnackBar,
private signupService: SignupService,
private router: Router,
) {}
ngOnInit() {
......@@ -44,11 +47,12 @@ export class SignupComponent implements OnInit {
)
.subscribe({
next: (response: any) => {
window.location.href = '/login';
this.snackBar.open(PLEASE_CHECK_EMAIL, CLOSE, { duration: 5000 });
this.router.navigateByUrl('/login');
},
error: err => {
if (typeof err.error.message === 'string') {
this.snackBar.open(err.error.message, null, { duration: 2500 });
this.snackBar.open(err.error.message, null, { duration: 5000 });
} else {
this.snackBar.open(SOMETHING_WENT_WRONG);
}
......
export const APP_ID = 'authorization-server';
export const CLOSE = 'close';
export const PLEASE_CHECK_EMAIL = 'Please check email to reset password';
export const PLEASE_CHECK_EMAIL = 'Please check your email';
export const PLEASE_CHECK_USERNAME =
'Something went wrong, Please re-check username';
export const AVAILABLE_TRANSLATIONS = [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment