Compare commits

...

2 Commits

Author SHA1 Message Date
387acdbd09 Merge pull request 'log if admin resets the pw for someone' (#511) from log-pw-reset into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 9m31s
CI/CD Pipeline / deploy-staging (push) Successful in 8m6s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #511
2024-05-21 09:06:37 +02:00
b36144832a log if admin resets the pw for someone
Some checks failed
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
CI/CD Pipeline / test (push) Has been cancelled
2024-05-21 09:05:36 +02:00

View File

@ -226,10 +226,15 @@ async fn send_welcome_mail(
} }
#[get("/user/<user>/reset-pw")] #[get("/user/<user>/reset-pw")]
async fn resetpw(db: &State<SqlitePool>, _admin: AdminUser, user: i32) -> Flash<Redirect> { async fn resetpw(db: &State<SqlitePool>, admin: AdminUser, user: i32) -> Flash<Redirect> {
let user = User::find_by_id(db, user).await; let user = User::find_by_id(db, user).await;
match user { match user {
Some(user) => { Some(user) => {
Log::create(
db,
format!("{} has resetted the pw for {}", admin.user.name, user.name),
)
.await;
user.reset_pw(db).await; user.reset_pw(db).await;
Flash::success( Flash::success(
Redirect::to("/admin/user"), Redirect::to("/admin/user"),