mirror of
https://git.verdigado.com/NB-Public/simple-wkd.git
synced 2024-12-06 14:52:41 +01:00
Improve file checking
This commit is contained in:
parent
9efbaefd92
commit
4b445a6a96
5 changed files with 18 additions and 4 deletions
|
@ -3,6 +3,8 @@ mod errors;
|
|||
mod management;
|
||||
mod utils;
|
||||
|
||||
use crate::utils::key_exists;
|
||||
|
||||
use self::confirmation::{confirm_action, send_confirmation_email};
|
||||
use self::management::{clean_stale, store_pending_addition, store_pending_deletion, Action};
|
||||
use self::utils::{gen_random_token, get_email_from_cert, parse_pem};
|
||||
|
@ -69,6 +71,7 @@ async fn confirm(token: web::Path<Token>) -> Result<String> {
|
|||
|
||||
#[get("/api/delete/{address}")]
|
||||
async fn delete(email: web::Path<Email>) -> Result<String> {
|
||||
key_exists(&email.address)?;
|
||||
let token = gen_random_token();
|
||||
store_pending_deletion(email.address.clone(), &token)?;
|
||||
send_confirmation_email(&email.address, &Action::Delete, &token);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue