Format code
This commit is contained in:
@@ -80,10 +80,13 @@ impl EntityManager<User> {
|
||||
}
|
||||
|
||||
/// Update user information
|
||||
fn update_user<F>(&mut self, id: &UserID, update: F) -> bool where F: FnOnce(User) -> User {
|
||||
fn update_user<F>(&mut self, id: &UserID, update: F) -> bool
|
||||
where
|
||||
F: FnOnce(User) -> User,
|
||||
{
|
||||
let user = match self.find_by_user_id(id) {
|
||||
None => return false,
|
||||
Some(user) => user
|
||||
Some(user) => user,
|
||||
};
|
||||
|
||||
if let Err(e) = self.replace_entries(|u| u.uid.eq(id), &update(user)) {
|
||||
@@ -96,7 +99,7 @@ impl EntityManager<User> {
|
||||
|
||||
pub fn change_user_password(&mut self, id: &UserID, password: &str, temporary: bool) -> bool {
|
||||
let new_hash = match hash_password(password) {
|
||||
Ok(h) => { h }
|
||||
Ok(h) => h,
|
||||
Err(e) => {
|
||||
log::error!("Failed to hash user password! {}", e);
|
||||
return false;
|
||||
@@ -109,4 +112,4 @@ impl EntityManager<User> {
|
||||
user
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user