Frontend #143

Merged
Rripped merged 11 commits from frontend into main 2022-05-08 08:44:39 +00:00
3 changed files with 30 additions and 13 deletions
Showing only changes of commit 55db2069f7 - Show all commits

View File

@ -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>

View File

@ -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;
} }

View File

@ -11,18 +11,23 @@ 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 {
if (this.form.password === this.form.passwordRepeat) {
this.checkPasswordFailed = false;
const { email, username, password } = this.form; const { email, username, password } = this.form;
this.authService.register(email, username, password).subscribe( this.authService.register(email, username, password).subscribe(
(data) => { (data) => {
@ -35,5 +40,8 @@ export class RegisterComponent {
this.isSignUpFailed = true; this.isSignUpFailed = true;
} }
); );
} else {
this.checkPasswordFailed = true;
}
} }
} }