fix: update updated_at when reset user auth token (#1006)
parent
58787e707b
commit
766c481c68
|
|
@ -143,7 +143,7 @@ impl DbConn {
|
|||
pub async fn reset_registration_token(&self) -> Result<String> {
|
||||
let token = uuid::Uuid::new_v4().to_string();
|
||||
let result = token.clone();
|
||||
let updated_at = chrono::Utc::now().timestamp() as u32;
|
||||
let updated_at = chrono::Utc::now();
|
||||
|
||||
let res = self
|
||||
.conn
|
||||
|
|
|
|||
|
|
@ -178,10 +178,13 @@ impl DbConn {
|
|||
|
||||
pub async fn reset_user_auth_token_by_email(&self, email: &str) -> Result<()> {
|
||||
let email = email.to_owned();
|
||||
let updated_at = chrono::Utc::now();
|
||||
self.conn
|
||||
.call(move |c| {
|
||||
let mut stmt = c.prepare(r#"UPDATE users SET auth_token = ? WHERE email = ?"#)?;
|
||||
stmt.execute((generate_auth_token(), email))?;
|
||||
let mut stmt = c.prepare(
|
||||
r#"UPDATE users SET auth_token = ?, updated_at = ? WHERE email = ?"#,
|
||||
)?;
|
||||
stmt.execute((generate_auth_token(), updated_at, email))?;
|
||||
Ok(())
|
||||
})
|
||||
.await?;
|
||||
|
|
|
|||
Loading…
Reference in New Issue