feat: add existed phone number check when signup
Release package / release (push) Successful in 2m48s

This commit is contained in:
TakahashiNg
2026-03-23 01:02:25 +00:00
parent 4d3563a5f0
commit df716e60e4
3 changed files with 9 additions and 46 deletions
+2 -1
View File
@@ -14,7 +14,8 @@
"redhat.vscode-quarkus",
"vscjava.vscode-java-pack",
"redhat.vscode-xml",
"esbenp.prettier-vscode"
"esbenp.prettier-vscode",
"PeterSchmalfeldt.explorer-exclude"
]
}
},
-45
View File
@@ -1,45 +0,0 @@
#Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties
.flattened-pom.xml
# Eclipse
.project
.classpath
.settings/
bin/
# IntelliJ
.idea
*.ipr
*.iml
*.iws
# NetBeans
nb-configuration.xml
# Visual Studio Code
.vscode
.factorypath
# OSX
.DS_Store
# Vim
*.swp
*.swo
# patch
*.orig
*.rej
# Local environment
.env
# Plugin directory
/.quarkus/cli/plugins/
# TLS Certificates
.certs/
@@ -33,6 +33,12 @@ public abstract class User extends PanacheEntity {
@Transactional
public void signup(String name, String phone, String rawPassword) {
// Check existed user
Customer existedUser = User.find("phone", phone).firstResult();
if (existedUser != null) throw new BadRequestException("ExistedUser");
// Set user
this.name = name;
if (!PhoneValidator.isValidInternationalPhone(phone)) {
@@ -43,6 +49,7 @@ public abstract class User extends PanacheEntity {
this.hashedPassword = Password.hash(rawPassword).withArgon2().getResult();
// Save user
this.persist();
}