Add an API to reset the password
This commit is contained in:
parent
f4707b295f
commit
a631d5dbfc
@ -244,8 +244,13 @@ func (acc *Account) ResetPassword(ctx context.Context, emailConfig email.EmailCo
|
|||||||
} else if k8serrors.IsAlreadyExists(err) {
|
} else if k8serrors.IsAlreadyExists(err) {
|
||||||
timestamp := sec.CreationTimestamp.Time
|
timestamp := sec.CreationTimestamp.Time
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
if timestamp.Add(time.Minute).Before(now) {
|
if timestamp.Add(time.Minute).After(now) {
|
||||||
return "", errors.New("You can send an email once per minute, please wait")
|
return "", errors.New("you can send an email once per minute, please wait")
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := clientset.CoreV1().Secrets(acc.Data.UUID).Update(ctx, &secret, metav1.UpdateOptions{})
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user