Can change user password

This commit is contained in:
2022-04-05 17:17:34 +02:00
parent f21e40d804
commit 83e6871997
8 changed files with 236 additions and 59 deletions

View File

@@ -21,6 +21,12 @@ pub struct User {
pub authorized_services: Option<Vec<ServiceID>>,
}
impl User {
pub fn verify_password<P: AsRef<[u8]>>(&self, pass: P) -> bool {
verify_password(pass, &self.password)
}
}
impl PartialEq for User {
fn eq(&self, other: &Self) -> bool {
self.uid.eq(&other.uid)
@@ -81,8 +87,8 @@ impl EntityManager<User> {
/// Update user information
fn update_user<F>(&mut self, id: &UserID, update: F) -> bool
where
F: FnOnce(User) -> User,
where
F: FnOnce(User) -> User,
{
let user = match self.find_by_user_id(id) {
None => return false,