Browse Source
Merge branch 'master' into mariadb-fk-issues
pull/1150/head
Mathijs van Veluw
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
18 additions and
0 deletions
-
src/api/core/accounts.rs
|
|
@ -32,6 +32,7 @@ pub fn routes() -> Vec<rocket::Route> { |
|
|
|
revision_date, |
|
|
|
password_hint, |
|
|
|
prelogin, |
|
|
|
verify_password, |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
@ -623,3 +624,20 @@ fn prelogin(data: JsonUpcase<PreloginData>, conn: DbConn) -> JsonResult { |
|
|
|
"KdfIterations": kdf_iter |
|
|
|
}))) |
|
|
|
} |
|
|
|
#[derive(Deserialize)] |
|
|
|
#[allow(non_snake_case)] |
|
|
|
struct VerifyPasswordData { |
|
|
|
MasterPasswordHash: String, |
|
|
|
} |
|
|
|
|
|
|
|
#[post("/accounts/verify-password", data = "<data>")] |
|
|
|
fn verify_password(data: JsonUpcase<VerifyPasswordData>, headers: Headers, _conn: DbConn) -> EmptyResult { |
|
|
|
let data: VerifyPasswordData = data.into_inner().data; |
|
|
|
let user = headers.user; |
|
|
|
|
|
|
|
if !user.check_valid_password(&data.MasterPasswordHash) { |
|
|
|
err!("Invalid password") |
|
|
|
} |
|
|
|
|
|
|
|
Ok(()) |
|
|
|
} |
|
|
|