mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-10 02:27:26 +08:00
fix: typos, sql, some strings were odd
This commit is contained in:
@@ -166,14 +166,14 @@ class UserRegistrar(
|
||||
if (!user.emailConfirmed && emailProps.enable) 400 - "Email not verified"
|
||||
|
||||
val resets = async { resetPasswordRepo.findByAquaNetUserAuId(user.auId) }
|
||||
val lasReset = resets.maxByOrNull { it.createdAt }
|
||||
val lastReset = resets.maxByOrNull { it.createdAt }
|
||||
|
||||
if (lastReset?.createdAt?.plusSeconds(60)?.isAfter(Instant.now()) == true) {
|
||||
400 - "Reset request rejected - STATE_0"
|
||||
}
|
||||
|
||||
// Check if we have sent more than 3 confirmation emails in the last 24 hours
|
||||
if (confirmations.count { it.createdAt.plusSeconds(60 * 60 * 24).isAfter(Instant.now()) } > 3) {
|
||||
if (resets.count { it.createdAt.plusSeconds(60 * 60 * 24).isAfter(Instant.now()) } > 3) {
|
||||
400 - "Reset request rejected- STATE_1"
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,9 @@ import ext.Str
|
||||
import ext.logger
|
||||
import icu.samnyan.aqua.net.db.AquaNetUser
|
||||
import icu.samnyan.aqua.net.db.EmailConfirmation
|
||||
import icu.samnyan.aqua.net.db.PasswordReset
|
||||
import icu.samnyan.aqua.net.db.EmailConfirmationRepo
|
||||
import icu.samnyan.aqua.net.db.ResetPassword
|
||||
import icu.samnyan.aqua.net.db.ResetPasswordRepo
|
||||
import org.simplejavamail.api.mailer.Mailer
|
||||
import org.simplejavamail.email.EmailBuilder
|
||||
import org.simplejavamail.springsupport.SimpleJavaMailSpringSupport
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
CREATE TABLE aqua_net_email_password_reset
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT NOT NULL,
|
||||
token VARCHAR(255) NOT NULL,
|
||||
created_at datetime NOT NULL,
|
||||
au_id BIGINT NULL,
|
||||
CONSTRAINT pk_email_password_reset PRIMARY KEY (id)
|
||||
);
|
||||
@@ -4,4 +4,19 @@ CREATE TABLE aqua_net_session
|
||||
expiry datetime NOT NULL,
|
||||
au_id BIGINT NULL,
|
||||
CONSTRAINT pk_session PRIMARY KEY (token)
|
||||
);
|
||||
);
|
||||
|
||||
ALTER TABLE aqua_net_session
|
||||
ADD CONSTRAINT FK_SESSION FOREIGN KEY (au_id) REFERENCES aqua_net_user (au_id);
|
||||
|
||||
CREATE TABLE aqua_net_email_reset_password
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT NOT NULL,
|
||||
token VARCHAR(255) NOT NULL,
|
||||
created_at datetime NOT NULL,
|
||||
au_id BIGINT NULL,
|
||||
CONSTRAINT pk_email_reset_password PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
ALTER TABLE aqua_net_email_reset_password
|
||||
ADD CONSTRAINT FK_EMAIL_RESET_PASSWORD_ON_AQUA_USER FOREIGN KEY (au_id) REFERENCES aqua_net_user (au_id);
|
||||
Reference in New Issue
Block a user