Merge pull request #824 from tomuta/fix_change_email

Fix change email when no whitelist is configured
This commit is contained in:
Daniel García 2020-01-28 20:52:16 +01:00 committed by GitHub
commit 632d55265b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -510,7 +510,12 @@ impl Config {
warn!("Failed to parse email address '{}'", email);
return false;
}
self.signups_domains_whitelist().split(',').any(|d| d == e[0])
// Allow signups if the whitelist is empty/not configured
// (it doesn't contain any domains), or if it matches at least
// one domain.
let whitelist_str = self.signups_domains_whitelist();
whitelist_str.is_empty() || whitelist_str.split(',').filter(|s| !s.is_empty()).any(|d| d == e[0])
}
pub fn delete_user_config(&self) -> Result<(), Error> {