Merge pull request #5507 from mempool/nymkappa/faucet-unverified

[faucet] show unverified warning if no email provided
This commit is contained in:
wiz 2024-10-12 17:10:53 +09:00 committed by GitHub
commit 41088cca09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 13 deletions

View file

@ -27,6 +27,14 @@
<app-twitter-login customClass="btn btn-sm" width="220px" redirectTo="/testnet4/faucet" buttonString="Sign up with Twitter"></app-twitter-login>
</div>
}
@else if (user && user.status === 'pending' && !user.email && user.snsId) {
<div class="alert alert-danger w-100 col d-flex justify-content-center text-left">
<span class="d-flex">
<fa-icon [icon]="['fas', 'exclamation-triangle']" [fixedWidth]="true" class="mr-1"></fa-icon>
<span>Please <a class="text-primary" [routerLink]="['/services/account/settings']">verify your account</a> by providing a valid email address. To mitigate spam, we delete unverified accounts at regular intervals.</span>
</span>
</div>
}
@else if (error === 'not_available') {
<!-- User logged in but not a paid user or did not link its Twitter account -->
<div class="alert alert-mempool d-block text-center w-100">

View file

@ -1,7 +1,6 @@
import { Component, OnDestroy, OnInit, ChangeDetectorRef } from "@angular/core";
import { FormBuilder, FormGroup, Validators, ValidatorFn, AbstractControl, ValidationErrors } from "@angular/forms";
import { Subscription } from "rxjs";
import { StorageService } from "../../services/storage.service";
import { ServicesApiServices } from "../../services/services-api.service";
import { getRegex } from "../../shared/regex.utils";
import { StateService } from "../../services/state.service";
@ -34,7 +33,6 @@ export class FaucetComponent implements OnInit, OnDestroy {
constructor(
private cd: ChangeDetectorRef,
private storageService: StorageService,
private servicesApiService: ServicesApiServices,
private formBuilder: FormBuilder,
private stateService: StateService,
@ -56,14 +54,17 @@ export class FaucetComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.user = this.storageService.getAuth()?.user ?? null;
if (!this.user) {
this.loading = false;
return;
}
// Setup form
this.updateFaucetStatus();
this.servicesApiService.userSubject$.subscribe(user => {
this.user = user;
if (!user) {
this.loading = false;
this.cd.markForCheck();
return;
}
// Setup form
this.updateFaucetStatus();
this.cd.markForCheck();
});
// Track transaction
this.websocketService.want(['blocks', 'mempool-blocks']);
@ -145,9 +146,6 @@ export class FaucetComponent implements OnInit, OnDestroy {
'address': ['', [Validators.required, Validators.pattern(getRegex('address', 'testnet4')), this.getNotFaucetAddressValidator(faucetAddress)]],
'satoshis': [min, [Validators.required, Validators.min(min), Validators.max(max)]]
});
this.loading = false;
this.cd.markForCheck();
}
updateForm(min, max, faucetAddress: string): void {
@ -160,6 +158,8 @@ export class FaucetComponent implements OnInit, OnDestroy {
this.faucetForm.get('satoshis').updateValueAndValidity();
this.faucetForm.get('satoshis').markAsDirty();
}
this.loading = false;
this.cd.markForCheck();
}
setAmount(value: number): void {