feat: added machanism for not allowing users to sign up with forbidden/restricted usernames.
Names will be added to the nixos config. Closes #23
This commit is contained in:
parent
35952a2030
commit
dadaf73c78
3 changed files with 26 additions and 4 deletions
|
@ -190,6 +190,7 @@ pub struct Config {
|
|||
pub mail_pass: String,
|
||||
pub ssh_root: String,
|
||||
pub auth_discord: String,
|
||||
pub users_restricted: Vec<String>,
|
||||
}
|
||||
|
||||
pub fn get_config() -> Config {
|
||||
|
@ -209,6 +210,7 @@ pub fn get_config() -> Config {
|
|||
mail_pass: "".to_string(),
|
||||
ssh_root: "skynet_old".to_string(),
|
||||
auth_discord: "".to_string(),
|
||||
users_restricted: vec![],
|
||||
};
|
||||
|
||||
if let Ok(x) = env::var("LDAP_HOST") {
|
||||
|
@ -248,6 +250,13 @@ pub fn get_config() -> Config {
|
|||
config.auth_discord = x.trim().to_string();
|
||||
}
|
||||
|
||||
if let Ok(x) = env::var("USERS_RESTRICTED") {
|
||||
// usernames that are restricted
|
||||
for user in x.split(',').collect::<Vec<&str>>() {
|
||||
config.users_restricted.push(user.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
config
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue