#11 signup email #36

Merged
silver merged 5 commits from #11_signup_email into main 2023-08-06 12:02:40 +00:00
2 changed files with 186 additions and 178 deletions
Showing only changes of commit 158292be05 - Show all commits

View file

@ -1,6 +1,9 @@
use skynet_ldap_backend::{ use skynet_ldap_backend::{
db_init, get_config, db_init, get_config,
methods::{account_new::post_new_account, account_update::post_update_ldap}, methods::{
account_new::post::{account, email},
account_update::post_update_ldap,
},
State, State,
}; };
@ -21,7 +24,8 @@ 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(post_update_ldap);
app.at("/ldap/new").post(post_new_account); app.at("/ldap/new/email").post(email::submit);
app.at("/ldap/new/account").post(account::submit);
app.listen(host_port).await?; app.listen(host_port).await?;
Ok(()) Ok(())

View file

@ -232,7 +232,9 @@ pub mod post {
.await .await
} }
} }
}
pub mod account {
use super::*;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
struct LdapNewUser { struct LdapNewUser {
@ -244,7 +246,7 @@ struct LdapNewUser {
/// Handles initial detail entering page /// Handles initial detail entering page
/// Verify users have access to said email /// Verify users have access to said email
/// Get users to set username and password. /// Get users to set username and password.
pub async fn post_new_account(mut req: Request<State>) -> tide::Result { pub async fn submit(mut req: Request<State>) -> tide::Result {
let LdapNewUser { let LdapNewUser {
auth, auth,
user, user,
@ -452,3 +454,5 @@ async fn account_verification_clear_pending(db: &Pool<Sqlite>, auth_code: &str)
.fetch_all(db) .fetch_all(db)
.await .await
} }
}
}