[faucet] show unverified warning if no email provided

This commit is contained in:
nymkappa 2024-09-10 12:07:46 +02:00
parent 485a58e453
commit a133ddf062
No known key found for this signature in database
GPG key ID: 92358FC85D9645DE
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> <app-twitter-login customClass="btn btn-sm" width="220px" redirectTo="/testnet4/faucet" buttonString="Sign up with Twitter"></app-twitter-login>
</div> </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') { @else if (error === 'not_available') {
<!-- User logged in but not a paid user or did not link its Twitter account --> <!-- 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"> <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 { Component, OnDestroy, OnInit, ChangeDetectorRef } from "@angular/core";
import { FormBuilder, FormGroup, Validators, ValidatorFn, AbstractControl, ValidationErrors } from "@angular/forms"; import { FormBuilder, FormGroup, Validators, ValidatorFn, AbstractControl, ValidationErrors } from "@angular/forms";
import { Subscription } from "rxjs"; import { Subscription } from "rxjs";
import { StorageService } from "../../services/storage.service";
import { ServicesApiServices } from "../../services/services-api.service"; import { ServicesApiServices } from "../../services/services-api.service";
import { getRegex } from "../../shared/regex.utils"; import { getRegex } from "../../shared/regex.utils";
import { StateService } from "../../services/state.service"; import { StateService } from "../../services/state.service";
@ -34,7 +33,6 @@ export class FaucetComponent implements OnInit, OnDestroy {
constructor( constructor(
private cd: ChangeDetectorRef, private cd: ChangeDetectorRef,
private storageService: StorageService,
private servicesApiService: ServicesApiServices, private servicesApiService: ServicesApiServices,
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
private stateService: StateService, private stateService: StateService,
@ -56,14 +54,17 @@ export class FaucetComponent implements OnInit, OnDestroy {
} }
ngOnInit() { ngOnInit() {
this.user = this.storageService.getAuth()?.user ?? null; this.servicesApiService.userSubject$.subscribe(user => {
if (!this.user) { this.user = user;
this.loading = false; if (!user) {
return; this.loading = false;
} this.cd.markForCheck();
return;
// Setup form }
this.updateFaucetStatus(); // Setup form
this.updateFaucetStatus();
this.cd.markForCheck();
});
// Track transaction // Track transaction
this.websocketService.want(['blocks', 'mempool-blocks']); 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)]], 'address': ['', [Validators.required, Validators.pattern(getRegex('address', 'testnet4')), this.getNotFaucetAddressValidator(faucetAddress)]],
'satoshis': [min, [Validators.required, Validators.min(min), Validators.max(max)]] 'satoshis': [min, [Validators.required, Validators.min(min), Validators.max(max)]]
}); });
this.loading = false;
this.cd.markForCheck();
} }
updateForm(min, max, faucetAddress: string): void { 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').updateValueAndValidity();
this.faucetForm.get('satoshis').markAsDirty(); this.faucetForm.get('satoshis').markAsDirty();
} }
this.loading = false;
this.cd.markForCheck();
} }
setAmount(value: number): void { setAmount(value: number): void {