improve logging
This commit is contained in:
		| @@ -532,17 +532,19 @@ ASKÖ Ruderverein Donau Linz", self.name), | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     pub async fn reset_pw(&self, db: &SqlitePool) { |     pub async fn reset_pw(&self, db: &SqlitePool, changed_by: &ManageUserUser) { | ||||||
|         sqlx::query!("UPDATE user SET pw = null where id = ?", self.id) |         sqlx::query!("UPDATE user SET pw = null where id = ?", self.id) | ||||||
|             .execute(db) |             .execute(db) | ||||||
|             .await |             .await | ||||||
|             .unwrap(); //Okay, because we can only create a User of a valid id |             .unwrap(); //Okay, because we can only create a User of a valid id | ||||||
|  |  | ||||||
|         // TODO: add responsible person |         // TODO: add responsible person | ||||||
|         ActivityBuilder::new(&format!("Passwort von User {self} wurde zurückgesetzt.")) |         ActivityBuilder::new(&format!( | ||||||
|             .relevant_for_user(self) |             "{changed_by} hat das Passwort von User {self} zurückgesetzt." | ||||||
|             .save(db) |         )) | ||||||
|             .await; |         .relevant_for_user(self) | ||||||
|  |         .save(db) | ||||||
|  |         .await; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     pub async fn update_pw(&self, db: &SqlitePool, pw: &str) { |     pub async fn update_pw(&self, db: &SqlitePool, pw: &str) { | ||||||
| @@ -551,12 +553,10 @@ ASKÖ Ruderverein Donau Linz", self.name), | |||||||
|             .execute(db) |             .execute(db) | ||||||
|             .await |             .await | ||||||
|             .unwrap(); //Okay, because we can only create a User of a valid id |             .unwrap(); //Okay, because we can only create a User of a valid id | ||||||
|         ActivityBuilder::new(&format!( |         ActivityBuilder::new(&format!("{self} hat sein Passwort geändert.")) | ||||||
|             "Passwort von User {self} wurde erfolgreich geändert." |             .relevant_for_user(self) | ||||||
|         )) |             .save(db) | ||||||
|         .relevant_for_user(self) |             .await; | ||||||
|         .save(db) |  | ||||||
|         .await; |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     fn get_hashed_pw(pw: &str) -> String { |     fn get_hashed_pw(pw: &str) -> String { | ||||||
|   | |||||||
| @@ -277,7 +277,7 @@ async fn resetpw(db: &State<SqlitePool>, admin: ManageUserUser, user: i32) -> Fl | |||||||
|                 format!("{} has resetted the pw for {}", admin.user.name, user.name), |                 format!("{} has resetted the pw for {}", admin.user.name, user.name), | ||||||
|             ) |             ) | ||||||
|             .await; |             .await; | ||||||
|             user.reset_pw(db).await; |             user.reset_pw(db, &admin).await; | ||||||
|             Flash::success( |             Flash::success( | ||||||
|                 Redirect::to("/admin/user"), |                 Redirect::to("/admin/user"), | ||||||
|                 format!("Passwort von {} zurückgesetzt", user.name), |                 format!("Passwort von {} zurückgesetzt", user.name), | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user