Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"bssapp-backend/internal/security"
|
||||
"database/sql"
|
||||
"encoding/hex"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
@@ -21,8 +20,7 @@ func ValidatePasswordResetTokenHandler(db *sql.DB) http.HandlerFunc {
|
||||
}
|
||||
|
||||
// 🔐 plain token -> hash
|
||||
h := sha256.Sum256([]byte(token))
|
||||
tokenHash := hex.EncodeToString(h[:])
|
||||
tokenHash := security.HashToken(token)
|
||||
|
||||
var (
|
||||
userID int64
|
||||
@@ -31,8 +29,8 @@ func ValidatePasswordResetTokenHandler(db *sql.DB) http.HandlerFunc {
|
||||
)
|
||||
|
||||
err := db.QueryRow(`
|
||||
SELECT user_id, expires_at, used_at
|
||||
FROM password_reset_tokens
|
||||
SELECT dfusr_id, expires_at, used_at
|
||||
FROM dfusr_password_reset
|
||||
WHERE token_hash = $1
|
||||
LIMIT 1
|
||||
`, tokenHash).Scan(&userID, &expiresAt, &usedAt)
|
||||
|
||||
Reference in New Issue
Block a user