1 /* Copyright (c) 2019 AT&T Intellectual Property. #
\r
3 # Licensed under the Apache License, Version 2.0 (the "License"); #
\r
4 # you may not use this file except in compliance with the License. #
\r
5 # You may obtain a copy of the License at #
\r
7 # http://www.apache.org/licenses/LICENSE-2.0 #
\r
9 # Unless required by applicable law or agreed to in writing, software #
\r
10 # distributed under the License is distributed on an "AS IS" BASIS, #
\r
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
\r
12 # See the License for the specific language governing permissions and #
\r
13 # limitations under the License. #
\r
14 ##############################################################################*/
\r
17 import { Component, OnInit } from '@angular/core';
\r
18 import { routerTransition } from '../router.animations';
\r
19 import { HttpClient } from '@angular/common/http';
\r
20 import { AppGlobals } from '../app.global';
\r
21 import { UserService } from '../shared/services/user.service';
\r
22 import { Router } from '@angular/router';
\r
23 import { User } from '../shared/models/user.model';
\r
24 import { MatDialog } from '@angular/material';
\r
25 import { AlertModalComponent } from '../shared/modules/alert-modal/alert-modal.component';
\r
26 import { AuthService } from '../shared/services/auth.service';
\r
30 selector: 'app-signup',
\r
31 templateUrl: './signup.component.html',
\r
32 styleUrls: ['./signup.component.scss'],
\r
33 animations: [routerTransition()]
\r
35 export class SignupComponent implements OnInit {
\r
42 public passwordConfirm;
\r
44 constructor(public router: Router,
\r
45 private auth: AuthService,
\r
46 public dialog: MatDialog
\r
57 // firstName: this.user.firstName,
\r
58 // lastName: this.user.lastName,
\r
59 // email: this.user.email,
\r
60 // password: this.user.password
\r
63 if(this.user.password != this.passwordConfirm){
\r
64 const dialogRef = this.dialog.open(AlertModalComponent, {
\r
67 message: "Passwords must match!"
\r
75 this.auth.register(this.user)
\r
78 const r = this.dialog.open(AlertModalComponent, {
\r
81 message: "Check your email to verify your account."
\r
85 r.afterClosed().subscribe(res => {
\r
86 this.router.navigateByUrl('/login');
\r
91 this.dialog.open(AlertModalComponent, {
\r