mirror of
				https://github.com/nitnelave/lldap.git
				synced 2023-04-12 14:25:13 +00:00 
			
		
		
		
	allow admin email to be set via config
This commit is contained in:
		
							parent
							
								
									294ce77a47
								
							
						
					
					
						commit
						0f9b0af1c1
					
				@ -45,6 +45,11 @@
 | 
				
			|||||||
## For the administration interface, this is the username.
 | 
					## For the administration interface, this is the username.
 | 
				
			||||||
#ldap_user_dn = "admin"
 | 
					#ldap_user_dn = "admin"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Admin email.
 | 
				
			||||||
 | 
					## Email for the admin account. It is only used when initially creating
 | 
				
			||||||
 | 
					## the admin user, and can safely be omitted.
 | 
				
			||||||
 | 
					#ldap_user_email = "admin@example.com"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Admin password.
 | 
					## Admin password.
 | 
				
			||||||
## Password for the admin account, both for the LDAP bind and for the
 | 
					## Password for the admin account, both for the LDAP bind and for the
 | 
				
			||||||
## administration interface. It is only used when initially creating
 | 
					## administration interface. It is only used when initially creating
 | 
				
			||||||
 | 
				
			|||||||
@ -71,6 +71,8 @@ pub struct Configuration {
 | 
				
			|||||||
    pub ldap_base_dn: String,
 | 
					    pub ldap_base_dn: String,
 | 
				
			||||||
    #[builder(default = r#"UserId::new("admin")"#)]
 | 
					    #[builder(default = r#"UserId::new("admin")"#)]
 | 
				
			||||||
    pub ldap_user_dn: UserId,
 | 
					    pub ldap_user_dn: UserId,
 | 
				
			||||||
 | 
					    #[builder(default = r#"String::default()"#)]
 | 
				
			||||||
 | 
					    pub ldap_user_email: String,
 | 
				
			||||||
    #[builder(default = r#"SecUtf8::from("password")"#)]
 | 
					    #[builder(default = r#"SecUtf8::from("password")"#)]
 | 
				
			||||||
    pub ldap_user_pass: SecUtf8,
 | 
					    pub ldap_user_pass: SecUtf8,
 | 
				
			||||||
    #[builder(default = r#"String::from("sqlite://users.db?mode=rwc")"#)]
 | 
					    #[builder(default = r#"String::from("sqlite://users.db?mode=rwc")"#)]
 | 
				
			||||||
 | 
				
			|||||||
@ -30,6 +30,7 @@ async fn create_admin_user(handler: &SqlBackendHandler, config: &Configuration)
 | 
				
			|||||||
    handler
 | 
					    handler
 | 
				
			||||||
        .create_user(CreateUserRequest {
 | 
					        .create_user(CreateUserRequest {
 | 
				
			||||||
            user_id: config.ldap_user_dn.clone(),
 | 
					            user_id: config.ldap_user_dn.clone(),
 | 
				
			||||||
 | 
					            email: config.ldap_user_email.clone(),
 | 
				
			||||||
            display_name: Some("Administrator".to_string()),
 | 
					            display_name: Some("Administrator".to_string()),
 | 
				
			||||||
            ..Default::default()
 | 
					            ..Default::default()
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user