buttons cannot be clicked multiple times
This commit is contained in:
parent
da1a1b1516
commit
06928fe245
9 changed files with 32 additions and 8 deletions
|
|
@ -39,7 +39,10 @@
|
||||||
[imgPath]="'play'"
|
[imgPath]="'play'"
|
||||||
[imgPath]="'arrow_right'"
|
[imgPath]="'arrow_right'"
|
||||||
[imgReverse]="true"
|
[imgReverse]="true"
|
||||||
[disabled]="!isUserEmailValid(authData.mail) && authData.mail.length > 0"
|
[disabled]="
|
||||||
|
(!isUserEmailValid(authData.mail) && authData.mail.length > 0) ||
|
||||||
|
authData.send
|
||||||
|
"
|
||||||
></app-btn-large>
|
></app-btn-large>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import { AuthService } from '../../services/auth.service';
|
||||||
export class AuthComponent {
|
export class AuthComponent {
|
||||||
authData = {
|
authData = {
|
||||||
mail: '',
|
mail: '',
|
||||||
|
send: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
|
@ -42,11 +43,13 @@ export class AuthComponent {
|
||||||
email: this.authData.mail,
|
email: this.authData.mail,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
this.authData.send = true;
|
||||||
await this.authService.checkAuthUserMail(body);
|
await this.authService.checkAuthUserMail(body);
|
||||||
const queryParams = { mail: this.authData.mail };
|
const queryParams = { mail: this.authData.mail };
|
||||||
this.router.navigate(['/register'], { queryParams });
|
this.router.navigate(['/register'], { queryParams });
|
||||||
this.errorService.clearError();
|
this.errorService.clearError();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.authData.send = false;
|
||||||
this.errorService.handleError(error);
|
this.errorService.handleError(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
</div>
|
</div>
|
||||||
<app-btn-large
|
<app-btn-large
|
||||||
[value]="'Send Email'"
|
[value]="'Send Email'"
|
||||||
[disabled]="!isUserEmailValid(authData.mail)"
|
[disabled]="!isUserEmailValid(authData.mail) || authData.send"
|
||||||
></app-btn-large>
|
></app-btn-large>
|
||||||
</form>
|
</form>
|
||||||
} @else { @if (sendMailSuccess) {
|
} @else { @if (sendMailSuccess) {
|
||||||
|
|
@ -132,7 +132,8 @@
|
||||||
!isUserEmailValid(authData.mail) ||
|
!isUserEmailValid(authData.mail) ||
|
||||||
authData.password !== authData.passwordConfirm ||
|
authData.password !== authData.passwordConfirm ||
|
||||||
!authData.password ||
|
!authData.password ||
|
||||||
!authData.passwordConfirm
|
!authData.passwordConfirm ||
|
||||||
|
authData.send
|
||||||
"
|
"
|
||||||
></app-btn-large>
|
></app-btn-large>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ export class ForgotPasswordComponent implements OnInit {
|
||||||
token: '',
|
token: '',
|
||||||
password: '',
|
password: '',
|
||||||
passwordConfirm: '',
|
passwordConfirm: '',
|
||||||
|
send: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
sendMailSuccess: boolean = false;
|
sendMailSuccess: boolean = false;
|
||||||
|
|
@ -70,10 +71,12 @@ export class ForgotPasswordComponent implements OnInit {
|
||||||
email: this.authData.mail,
|
email: this.authData.mail,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
this.authData.send = true;
|
||||||
await this.authService.forgotPassword(body);
|
await this.authService.forgotPassword(body);
|
||||||
this.sendMailSuccess = true;
|
this.sendMailSuccess = true;
|
||||||
this.errorService.clearError();
|
this.errorService.clearError();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.authData.send = false;
|
||||||
this.sendMailSuccess = false;
|
this.sendMailSuccess = false;
|
||||||
this.errorService.handleError(error);
|
this.errorService.handleError(error);
|
||||||
}
|
}
|
||||||
|
|
@ -85,14 +88,14 @@ export class ForgotPasswordComponent implements OnInit {
|
||||||
token: this.authData.token,
|
token: this.authData.token,
|
||||||
new_password: this.authData.password,
|
new_password: this.authData.password,
|
||||||
};
|
};
|
||||||
console.log(body);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
this.authData.send = true;
|
||||||
await this.authService.changePassword(body);
|
await this.authService.changePassword(body);
|
||||||
this.queryEmail = false;
|
this.queryEmail = false;
|
||||||
this.queryEmailSuccess = true;
|
this.queryEmailSuccess = true;
|
||||||
this.errorService.clearError();
|
this.errorService.clearError();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.authData.send = false;
|
||||||
this.errorService.handleError(error);
|
this.errorService.handleError(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,13 +83,16 @@
|
||||||
!authData.mail ||
|
!authData.mail ||
|
||||||
(!isUserEmailValid(authData.mail) && authData.mail.length > 0) ||
|
(!isUserEmailValid(authData.mail) && authData.mail.length > 0) ||
|
||||||
!password.valid ||
|
!password.valid ||
|
||||||
authData.guestLogin
|
authData.guestLogin ||
|
||||||
|
authData.send
|
||||||
"
|
"
|
||||||
></app-btn-large>
|
></app-btn-large>
|
||||||
<app-btn-large
|
<app-btn-large
|
||||||
[value]="'Guest Log in'"
|
[value]="'Guest Log in'"
|
||||||
[disabled]="
|
[disabled]="
|
||||||
authData.guestLogin || (!!authData.mail && !!authData.password)
|
authData.guestLogin ||
|
||||||
|
(!!authData.mail && !!authData.password) ||
|
||||||
|
authData.send
|
||||||
"
|
"
|
||||||
(click)="guestLogin()"
|
(click)="guestLogin()"
|
||||||
></app-btn-large>
|
></app-btn-large>
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ export class LoginComponent {
|
||||||
password: environment.guestPassword,
|
password: environment.guestPassword,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
this.authData.send = true;
|
||||||
await this.authService.login(body, this.authData.checkbox);
|
await this.authService.login(body, this.authData.checkbox);
|
||||||
this.authData.mail = '';
|
this.authData.mail = '';
|
||||||
this.authData.password = '';
|
this.authData.password = '';
|
||||||
|
|
@ -52,6 +53,7 @@ export class LoginComponent {
|
||||||
this.router.navigate(['/browse/']);
|
this.router.navigate(['/browse/']);
|
||||||
this.errorService.clearError();
|
this.errorService.clearError();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.authData.send = false;
|
||||||
this.errorService.handleError(error);
|
this.errorService.handleError(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -63,11 +65,13 @@ export class LoginComponent {
|
||||||
password: this.authData.password,
|
password: this.authData.password,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
this.authData.send = true;
|
||||||
await this.authService.login(body, this.authData.checkbox);
|
await this.authService.login(body, this.authData.checkbox);
|
||||||
ngForm.resetForm();
|
ngForm.resetForm();
|
||||||
this.router.navigate(['/browse/']);
|
this.router.navigate(['/browse/']);
|
||||||
this.errorService.clearError();
|
this.errorService.clearError();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.authData.send = false;
|
||||||
this.errorService.handleError(error);
|
this.errorService.handleError(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,8 @@
|
||||||
authData.password !== authData.passwordConfirm ||
|
authData.password !== authData.passwordConfirm ||
|
||||||
!authData.password ||
|
!authData.password ||
|
||||||
!authData.passwordConfirm ||
|
!authData.passwordConfirm ||
|
||||||
!authData.privacyPolicy
|
!authData.privacyPolicy ||
|
||||||
|
authData.send
|
||||||
"
|
"
|
||||||
></app-btn-large>
|
></app-btn-large>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ export class RegisterComponent implements OnInit {
|
||||||
password: '',
|
password: '',
|
||||||
passwordConfirm: '',
|
passwordConfirm: '',
|
||||||
privacyPolicy: false,
|
privacyPolicy: false,
|
||||||
|
send: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
registrationSuccess: boolean = false;
|
registrationSuccess: boolean = false;
|
||||||
|
|
@ -49,11 +50,13 @@ export class RegisterComponent implements OnInit {
|
||||||
password: this.authData.password,
|
password: this.authData.password,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
this.authData.send = true;
|
||||||
await this.authService.register(body);
|
await this.authService.register(body);
|
||||||
ngForm.resetForm();
|
ngForm.resetForm();
|
||||||
this.registrationSuccess = true;
|
this.registrationSuccess = true;
|
||||||
this.errorService.clearError();
|
this.errorService.clearError();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.authData.send = false;
|
||||||
this.errorService.handleError(error);
|
this.errorService.handleError(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ export class VerifyEmailComponent {
|
||||||
authData = {
|
authData = {
|
||||||
mail: '',
|
mail: '',
|
||||||
token: '',
|
token: '',
|
||||||
|
send: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
|
@ -40,10 +41,12 @@ export class VerifyEmailComponent {
|
||||||
token: this.authData.token,
|
token: this.authData.token,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
this.authData.send = true;
|
||||||
await this.authService.verifyEmail(body);
|
await this.authService.verifyEmail(body);
|
||||||
this.verified = true;
|
this.verified = true;
|
||||||
this.errorService.clearError();
|
this.errorService.clearError();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.authData.send = false;
|
||||||
this.verified = false;
|
this.verified = false;
|
||||||
this.errorService.handleError(error);
|
this.errorService.handleError(error);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue