mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-09-20 11:58:47 +00:00
Start to implement data export
This commit is contained in:
@@ -146,6 +146,17 @@ pub fn get_user_id_from_password_reset_token(token: &str) -> ResultBoxError<User
|
||||
.query_row(|r| r.get_user_id("ID"))
|
||||
}
|
||||
|
||||
/// Check current user's password
|
||||
pub fn check_user_password(user_id: &UserID, password: &str) -> ResultBoxError<bool> {
|
||||
let crypt_pass = crypt_pass(password)?;
|
||||
|
||||
database::QueryInfo::new(USERS_TABLE)
|
||||
.cond_user_id("ID", user_id)
|
||||
.cond("password", &crypt_pass)
|
||||
.exec_count()
|
||||
.map(|r| r > 0)
|
||||
}
|
||||
|
||||
/// Change the password of a user
|
||||
pub fn change_password(user_id: &UserID, new_password: &String) -> ResultBoxError {
|
||||
database::UpdateInfo::new(USERS_TABLE)
|
||||
|
Reference in New Issue
Block a user