1
0
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:
2020-07-13 18:56:36 +02:00
parent ded88474d5
commit f21636aa4e
5 changed files with 35 additions and 1 deletions

View File

@@ -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)