From a133ddf062609f3ced6291e267072e01d7dc09e3 Mon Sep 17 00:00:00 2001
From: nymkappa <1612910616@pm.me>
Date: Tue, 10 Sep 2024 12:07:46 +0200
Subject: [PATCH] [faucet] show unverified warning if no email provided
---
.../components/faucet/faucet.component.html | 8 ++++++
.../app/components/faucet/faucet.component.ts | 26 +++++++++----------
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/frontend/src/app/components/faucet/faucet.component.html b/frontend/src/app/components/faucet/faucet.component.html
index 0f0307e54..3165ae9a7 100644
--- a/frontend/src/app/components/faucet/faucet.component.html
+++ b/frontend/src/app/components/faucet/faucet.component.html
@@ -27,6 +27,14 @@
}
+ @else if (user && user.status === 'pending' && !user.email && user.snsId) {
+
+
+
+ Please verify your account by providing a valid email address. To mitigate spam, we delete unverified accounts at regular intervals.
+
+
+ }
@else if (error === 'not_available') {
diff --git a/frontend/src/app/components/faucet/faucet.component.ts b/frontend/src/app/components/faucet/faucet.component.ts
index 566a3b970..3e299b4fa 100644
--- a/frontend/src/app/components/faucet/faucet.component.ts
+++ b/frontend/src/app/components/faucet/faucet.component.ts
@@ -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 {