1
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-08-23 11:13:20 +00:00

Added SMTP test button in the admin gui

- Added a test button for checking the e-mail settings.
- Fixed a bug with the _post JavaScript function:
  A function was overwriten with a variable and errors were not handled
correctly like a 500 for example.
This commit is contained in:
BlackDex 2020-02-26 11:02:22 +01:00
commit 5a974c7b94
6 changed files with 201 additions and 8 deletions

View file

@ -34,6 +34,7 @@ pub fn routes() -> Vec<Route> {
post_config,
delete_config,
backup_db,
test_smtp,
]
}
@ -170,6 +171,18 @@ fn invite_user(data: Json<InviteData>, _token: AdminToken, conn: DbConn) -> Empt
}
}
#[post("/test/smtp", data = "<data>")]
fn test_smtp(data: Json<InviteData>, _token: AdminToken) -> EmptyResult {
let data: InviteData = data.into_inner();
let email = data.email.clone();
if CONFIG.mail_enabled() {
mail::send_test(&email)
} else {
err!("Mail is not enabled")
}
}
#[get("/logout")]
fn logout(mut cookies: Cookies) -> Result<Redirect, ()> {
cookies.remove(Cookie::named(COOKIE_NAME));