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