handle complete

This commit is contained in:
GotPPay
2018-06-01 12:06:55 +02:00
parent f61c8b084d
commit 4b78235ed7
2 changed files with 23 additions and 6 deletions

View File

@@ -112,8 +112,8 @@ func (c *passwordResetRepo) GetByToken(token string) (entity.PasswordReset, erro
func (c *passwordResetRepo) SetTokenOpened(token string) error {
const (
query = `UPDATE tab_password_reset a
SET a.opened = 1,
WHERE a.token = ? AND a.used = 0 AND a.expire_date < CURRENT_TIMESTAMP`
SET a.opened = 1
WHERE a.token = ? AND a.used = 0 AND a.expire_date > CURRENT_TIMESTAMP`
)
result, err := c.conn.Exec(query, token)
@@ -132,7 +132,7 @@ func (c *passwordResetRepo) SetTokenUsed(token string) error {
const (
query = `UPDATE tab_password_reset a
SET a.opened = 1,
a.used = 1,
a.used = 1
WHERE a.token = ? AND a.used = 0`
)