Frontend #143
@ -77,7 +77,7 @@
|
|||||||
type="password"
|
type="password"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
name="passwordRepeat"
|
name="passwordRepeat"
|
||||||
[(ngModel)]="form.password"
|
[(ngModel)]="form.passwordRepeat"
|
||||||
required
|
required
|
||||||
minlength="6"
|
minlength="6"
|
||||||
#passwordRepeat="ngModel"
|
#passwordRepeat="ngModel"
|
||||||
@ -88,6 +88,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="alert-danger" *ngIf="checkPasswordFailed">
|
||||||
|
Password does not match, make sure it is the same!
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button class="btn btn-primary btn-block">Sign Up</button>
|
<button class="btn btn-primary btn-block">Sign Up</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -11,4 +11,10 @@
|
|||||||
.backgorund {
|
.backgorund {
|
||||||
background-color: #181a1b;
|
background-color: #181a1b;
|
||||||
color: white;
|
color: white;
|
||||||
|
padding-top: 2vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-img-card {
|
||||||
|
border-radius: 2%;
|
||||||
|
box-shadow: 0 0 0 500px #181a1b;
|
||||||
}
|
}
|
||||||
|
@ -11,29 +11,37 @@ export class RegisterComponent {
|
|||||||
form: any = {
|
form: any = {
|
||||||
email: null,
|
email: null,
|
||||||
password: null,
|
password: null,
|
||||||
|
passwordRepeat: null,
|
||||||
username: null,
|
username: null,
|
||||||
};
|
};
|
||||||
isSuccessful = false;
|
isSuccessful = false;
|
||||||
isSignUpFailed = false;
|
isSignUpFailed = false;
|
||||||
errorMessage = '';
|
errorMessage = '';
|
||||||
|
|
||||||
|
checkPasswordFailed = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {AuthService} privateauthService
|
* @param {AuthService} privateauthService
|
||||||
* @param {Router} privaterouter
|
* @param {Router} privaterouter
|
||||||
*/
|
*/
|
||||||
constructor(private authService: AuthService, private router: Router) {}
|
constructor(private authService: AuthService, private router: Router) {}
|
||||||
onSubmit(): void {
|
onSubmit(): void {
|
||||||
const { email, username, password } = this.form;
|
if (this.form.password === this.form.passwordRepeat) {
|
||||||
this.authService.register(email, username, password).subscribe(
|
this.checkPasswordFailed = false;
|
||||||
(data) => {
|
const { email, username, password } = this.form;
|
||||||
this.isSuccessful = true;
|
this.authService.register(email, username, password).subscribe(
|
||||||
this.isSignUpFailed = false;
|
(data) => {
|
||||||
this.router.navigate(['/login']);
|
this.isSuccessful = true;
|
||||||
},
|
this.isSignUpFailed = false;
|
||||||
(err) => {
|
this.router.navigate(['/login']);
|
||||||
this.errorMessage = err.error.message;
|
},
|
||||||
this.isSignUpFailed = true;
|
(err) => {
|
||||||
}
|
this.errorMessage = err.error.message;
|
||||||
);
|
this.isSignUpFailed = true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.checkPasswordFailed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user