fix: better strucurter in other modules

This commit is contained in:
silver 2023-08-06 14:42:09 +01:00
parent 3165f67e4c
commit 9d28d89eee
3 changed files with 334 additions and 338 deletions

View file

@ -1,6 +1,6 @@
use skynet_ldap_backend::{ use skynet_ldap_backend::{
db_init, get_config, db_init, get_config,
methods::{account_new, account_recover, account_update::post_update_ldap}, methods::{account_new, account_recover, account_update},
State, State,
}; };
@ -20,9 +20,9 @@ async fn main() -> tide::Result<()> {
let mut app = tide::with_state(state); let mut app = tide::with_state(state);
app.at("/ldap/update").post(post_update_ldap); app.at("/ldap/update").post(account_update::submit);
app.at("/ldap/new/email").post(account_new::post::email::submit); app.at("/ldap/new/email").post(account_new::email::submit);
app.at("/ldap/new/account").post(account_new::post::account::submit); app.at("/ldap/new/account").post(account_new::account::submit);
app.at("/ldap/recover/password").post(account_recover::password::reset); app.at("/ldap/recover/password").post(account_recover::password::reset);
app.at("/ldap/recover/password/auth").post(account_recover::password::auth); app.at("/ldap/recover/password/auth").post(account_recover::password::auth);

View file

@ -13,10 +13,7 @@ use tide::{
Request, Request,
}; };
pub mod post { pub mod email {
use super::*;
pub mod email {
use super::*; use super::*;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
@ -231,9 +228,9 @@ pub mod post {
.fetch_optional(db) .fetch_optional(db)
.await .await
} }
} }
pub mod account { pub mod account {
use super::*; use super::*;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
@ -454,5 +451,4 @@ pub mod post {
.fetch_all(db) .fetch_all(db)
.await .await
} }
}
} }

View file

@ -25,7 +25,7 @@ pub struct ModifyResult {
} }
/// Handles updating a single field with the users own password /// Handles updating a single field with the users own password
pub async fn post_update_ldap(mut req: Request<State>) -> tide::Result { pub async fn submit(mut req: Request<State>) -> tide::Result {
let LdapUpdate { let LdapUpdate {
user, user,
pass, pass,