Skip to content

Commit

Permalink
Task #58821: Signup btn disabled to avoid multiple clicks
Browse files Browse the repository at this point in the history
  • Loading branch information
christyfernandes committed Jul 5, 2022
1 parent f5e35af commit b64d5c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ <h1 class="mat-h1 margin-remove inline-block ng-star-inserted">
<div class="button_box flex flex-col items-center justify-center">
<button mat-flat-button type="submit"
class="submitBtn text-white ws-mat-primary-background ws-mat-white-text"
(click)="signup()" [disabled]="!registrationForm?.valid || !confirm">
(click)="signup()" [disabled]="!registrationForm?.valid || !confirm || disableBtn">
SIGN UP
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export class PublicSignupComponent implements OnInit, OnDestroy {
telemetryConfig: NsInstanceConfig.ITelemetryConfig | null = null
portalID = ''
confirm = false
disableBtn = false

private subscriptionContact: Subscription | null = null
private recaptchaSubscription!: Subscription
Expand Down Expand Up @@ -197,7 +198,7 @@ export class PublicSignupComponent implements OnInit, OnDestroy {
}

signup() {

this.disableBtn = true
this.recaptchaSubscription = this.recaptchaV3Service.execute('importantAction')
.subscribe(
_token => {
Expand All @@ -221,8 +222,10 @@ export class PublicSignupComponent implements OnInit, OnDestroy {
(_res: any) => {
// console.log('success', res)
this.openDialog()
this.disableBtn = false
},
(err: any) => {
this.disableBtn = false
this.loggerSvc.error('Error in registering new user >', err)
if (err.error && err.error.params && err.error.params.errmsg) {
this.openSnackbar(err.error.params.errmsg)
Expand All @@ -234,6 +237,7 @@ export class PublicSignupComponent implements OnInit, OnDestroy {
)
},
error => {
this.disableBtn = false
// tslint:disable-next-line: no-console
console.error('captcha validation error', error)
this.openSnackbar(`reCAPTCHA validation failed: ${error}`)
Expand Down

0 comments on commit b64d5c0

Please sign in to comment.