openid_login: improve error message for disabled users.
This commit is contained in:
parent
3c56335d7b
commit
689ed51397
@ -176,8 +176,12 @@ pub fn openid_login(
|
|||||||
email,
|
email,
|
||||||
};
|
};
|
||||||
let (mut config, _digest) = user::config()?;
|
let (mut config, _digest) = user::config()?;
|
||||||
if config.sections.get(user.userid.as_str()).is_some() {
|
if let Ok(old_user) = config.lookup::<User>("user", user.userid.as_str()) {
|
||||||
bail!("autocreate user failed - '{}' already exists.", user.userid);
|
if let Some(false) = old_user.enable {
|
||||||
|
bail!("user '{}' is disabled.", user.userid);
|
||||||
|
} else {
|
||||||
|
bail!("autocreate user failed - '{}' already exists.", user.userid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
config.set_data(user.userid.as_str(), "user", &user)?;
|
config.set_data(user.userid.as_str(), "user", &user)?;
|
||||||
user::save_config(&config)?;
|
user::save_config(&config)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user