fix: typos, sql, some strings were odd

This commit is contained in:
Raymond 2025-07-29 15:55:38 -04:00 committed by Azalea
parent c01c40fe45
commit 92868201a3
6 changed files with 26 additions and 18 deletions

View File

@ -50,15 +50,15 @@ export const EN_REF_Welcome = {
'welcome.turnstile-timeout': 'Network verification timed out. Please try again.',
'welcome.verification-sent': 'A verification email has been sent to ${email}. Please check your inbox!',
'welcome.reset-password-sent': 'A password reset email has been sent to ${email}. Please check your inbox!',
'welcome.verify-state-0': 'You haven\'t verified your email. A verification email had been sent to your inbox less than a minute ago. Please check your inbox!',
'welcome.verify-state-1': 'You haven\'t verified your email. We\'ve already sent 3 emails over the last 24 hours so we\'ll not send another one. Please check your inbox!',
'welcome.verify-state-0': 'You haven\'t verified your email. A verification email has been sent to your inbox just now. Please check your inbox!',
'welcome.verify-state-1': 'You haven\'t verified your email. You have requested too many emails, please try again later.',
'welcome.verify-state-2': 'You haven\'t verified your email. We just sent you another verification email. Please check your inbox!',
'welcome.reset-state-0': 'A reset email had been sent to your inbox less than a minute ago. Please check your inbox!',
'welcome.reset-state-1': 'We\'ve already sent 3 emails over the last 24 hours so we\'ll not send another one. Please check your inbox!',
'welcome.reset-state-0': 'A reset email has been sent to your inbox just now. Please check your inbox!',
'welcome.reset-state-1': 'Too many emails have been sent. Another will not be sent.',
'welcome.verifying': 'Verifying your email... please wait.',
'welcome.verified': 'Your email has been verified! You can now log in now.',
'welcome.verification-failed': 'Verification failed: ${message}. Please try again.',
'welcome.password-reset-done': 'Your password has been changed! You can log in now.',
'welcome.password-reset-done': 'Your password has been updated! Please log back in.',
}
export const EN_REF_LEADERBOARD = {

View File

@ -164,7 +164,7 @@ async function login(user: { email: string, password: string, turnstile: string
}
async function resetPassword(user: { email: string, turnstile: string }) {
return await post('api/v2/user/reset-password', user)
return await post('/api/v2/user/reset-password', user)
}
async function changePassword(user: { token: string, password: string }) {

View File

@ -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"
}

View File

@ -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

View File

@ -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)
);

View File

@ -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);