chore: todo comments;
fix: txless creation of confirmation code in passwordresetbegin
This commit is contained in:
@@ -68,6 +68,8 @@ func (a *authServiceImpl) RegistrationBegin(request models.RegistrationBeginRequ
|
||||
helper, db, _ := database.NewDbHelperTransaction(a.dbctx)
|
||||
defer helper.Rollback()
|
||||
|
||||
// TODO: check occupation with redis
|
||||
|
||||
if occupationStatus, err = db.TXQueries.CheckUserRegistrationAvailability(db.CTX, database.CheckUserRegistrationAvailabilityParams{
|
||||
Email: request.Email,
|
||||
Username: request.Username,
|
||||
@@ -89,6 +91,7 @@ func (a *authServiceImpl) RegistrationBegin(request models.RegistrationBeginRequ
|
||||
|
||||
} else if occupationStatus.EmailBusy {
|
||||
// Falsely confirm in order to avoid disclosing registered email addresses
|
||||
// TODO: save this email into redis
|
||||
a.log.Warn(
|
||||
"Attempted registration for a taken email",
|
||||
zap.String("email", request.Email),
|
||||
@@ -176,7 +179,7 @@ func (a *authServiceImpl) RegistrationBegin(request models.RegistrationBeginRequ
|
||||
|
||||
} else {
|
||||
a.log.Debug(
|
||||
"Declated registration code for a new user. Enable SMTP in the config to disable this message",
|
||||
"Declared registration code for a new user. Enable SMTP in the config to disable this message",
|
||||
zap.String("username", user.Username),
|
||||
zap.String("code", generatedCode))
|
||||
}
|
||||
@@ -474,7 +477,7 @@ func (a *authServiceImpl) PasswordResetBegin(request models.PasswordResetBeginRe
|
||||
return false, errs.ErrServerError
|
||||
}
|
||||
|
||||
if _, err = db.TXlessQueries.CreateConfirmationCode(db.CTX, database.CreateConfirmationCodeParams{
|
||||
if _, err = db.TXQueries.CreateConfirmationCode(db.CTX, database.CreateConfirmationCodeParams{
|
||||
UserID: user.ID,
|
||||
CodeType: int32(enums.PasswordResetCodeType),
|
||||
CodeHash: hashedCode,
|
||||
|
||||
Reference in New Issue
Block a user