remove recover from recovery url
This commit is contained in:
parent
52b9682f60
commit
cc37aef684
@ -10,7 +10,6 @@ import (
|
|||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"gitea.pena/PenaSide/common/log_mw"
|
"gitea.pena/PenaSide/common/log_mw"
|
||||||
"time"
|
"time"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Deps struct {
|
type Deps struct {
|
||||||
@ -84,7 +83,7 @@ func (r *RecoveryController) HandleRecoveryRequest(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
signWithID := sign + id // подпись с id записи
|
signWithID := sign + id // подпись с id записи
|
||||||
|
|
||||||
err = r.service.RecoveryEmailTask(c.Context(), models.RecEmailDeps{UserID: user.ID.Hex(), Email: req.Email, SignWithID: strings.Replace(signUrl, "/changepwd","",1)+"/codeword/recover/"+signWithID, ID: id})
|
err = r.service.RecoveryEmailTask(c.Context(), models.RecEmailDeps{UserID: user.ID.Hex(), Email: req.Email, SignWithID: signUrl + "/"+signWithID, ID: id})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
r.logger.Error("Failed to send recovery email", zap.Error(err))
|
r.logger.Error("Failed to send recovery email", zap.Error(err))
|
||||||
|
|
||||||
@ -112,7 +111,7 @@ func (r *RecoveryController) HandleRecoveryLink(c *fiber.Ctx) error {
|
|||||||
record, err := r.service.GetRecoveryRecord(c.Context(), sign)
|
record, err := r.service.GetRecoveryRecord(c.Context(), sign)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
r.logger.Error("Recovery link expired", zap.String("signature", sign))
|
r.logger.Error("Recovery link expired", zap.String("signature", sign))
|
||||||
return c.Redirect("https://shub.pena.digital/recover/expired")
|
return c.Redirect("https://hub.pena.digital/recover/expired")
|
||||||
}
|
}
|
||||||
|
|
||||||
if time.Since(record.CreatedAt) > 15*time.Minute {
|
if time.Since(record.CreatedAt) > 15*time.Minute {
|
||||||
|
Loading…
Reference in New Issue
Block a user