Can remove clients
This commit is contained in:
@ -50,6 +50,9 @@ pub struct FormRequest {
|
||||
|
||||
/// Restrict new client to a given network
|
||||
ip_network: Option<String>,
|
||||
|
||||
/// Delete a specified client id
|
||||
delete_client_id: Option<uuid::Uuid>,
|
||||
}
|
||||
|
||||
/// Main route
|
||||
@ -114,6 +117,14 @@ pub async fn home(session: Session, form_req: Option<web::Form<FormRequest>>) ->
|
||||
config.save().await?;
|
||||
}
|
||||
}
|
||||
|
||||
// Delete a client
|
||||
if let Some(delete_client_id) = form_req.0.delete_client_id {
|
||||
config.clients.retain(|c| c.id != delete_client_id);
|
||||
config.save().await?;
|
||||
success_message = Some("The client was successfully deleted!".to_string());
|
||||
// TODO : close connections with given id
|
||||
}
|
||||
}
|
||||
|
||||
// Render page
|
||||
|
Reference in New Issue
Block a user