fix: remove discord from the signup

This commit is contained in:
silver 2023-06-04 21:47:30 +01:00
parent 5b6195db31
commit 36b13fb1f2
2 changed files with 5 additions and 10 deletions

View file

@ -15,7 +15,6 @@ pub struct AccountsPending {
name_first : String,
name_second : String,
auth_code : String,
discord: Option<String>,
// will only last for a few hours
expiry: i64
}
@ -42,7 +41,6 @@ pub async fn db_init(config: &Config) -> Result<Pool<Sqlite>, Error> {
name_first text not null,
name_second text not null,
auth_code text not null,
discord text,
expiry integer not null
)",
)

View file

@ -12,8 +12,7 @@ pub struct LdapNewUser {
// email that is used on wolves
mail: String,
name_first : String,
name_second : String,
discord: Option<String>
name_second : String
}
/// Handles initial detail entering page
@ -33,8 +32,7 @@ pub async fn post_new_account(mut req: Request<State>) -> tide::Result {
user,
mail,
name_first,
name_second,
discord
name_second
} = req.body_json().await?;
let config = &req.state().config;
@ -114,8 +112,8 @@ pub async fn post_new_account(mut req: Request<State>) -> tide::Result {
sqlx::query_as::<_, AccountsPending>(
r#"
INSERT OR REPLACE INTO accounts_pending (user, mail, name_first, name_second, auth_code, discord, expiry)
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7)
INSERT OR REPLACE INTO accounts_pending (user, mail, name_first, name_second, auth_code, expiry)
VALUES (?1, ?2, ?3, ?4, ?5, ?6)
"#,
)
.bind(&user)
@ -123,7 +121,6 @@ pub async fn post_new_account(mut req: Request<State>) -> tide::Result {
.bind(&name_first)
.bind(&name_second)
.bind(&auth_code)
.bind(&discord)
.bind(&expiry)
.fetch_optional(pool)
.await
@ -198,7 +195,7 @@ pub async fn post_new_account_confirmation(mut req: Request<State>) -> tide::Res
// need to bind as admin
ldap.simple_bind(&config.ldap_admin, &config.ldap_admin_pw)?.success()?;
let AccountsPending{ user, mail, name_first, name_second, auth_code, discord, expiry } = &results[0];
let AccountsPending{ user, mail, name_first, name_second, auth_code, expiry } = &results[0];
let dn = format!("uid={},ou=users,dc=skynet,dc=ie", user);
let uid_number = get_max_uid_number(db).await.to_string();
let home_directory = format!("/home/{}", user);