1
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-06-17 17:00:10 +00:00

include key into user.set_password

This commit is contained in:
sirux88 2023-01-14 10:16:03 +01:00 committed by Daniel García
parent 2d8c8e18f7
commit cc91ac6cc0
No known key found for this signature in database
GPG key ID: FC8A7D14C3CD543A
4 changed files with 21 additions and 12 deletions

View file

@ -147,17 +147,28 @@ impl User {
/// # Arguments
///
/// * `password` - A str which contains a hashed version of the users master password.
/// * `new_key` - A String which contains the new aKey value of the users master password.
/// * `allow_next_route` - A Option<Vec<String>> with the function names of the next allowed (rocket) routes.
/// These routes are able to use the previous stamp id for the next 2 minutes.
/// After these 2 minutes this stamp will expire.
///
pub fn set_password(&mut self, password: &str, reset_security_stamp: bool, allow_next_route: Option<Vec<String>>) {
pub fn set_password(
&mut self,
password: &str,
new_key: Option<String>,
reset_security_stamp: bool,
allow_next_route: Option<Vec<String>>,
) {
self.password_hash = crypto::hash_password(password.as_bytes(), &self.salt, self.password_iterations as u32);
if let Some(route) = allow_next_route {
self.set_stamp_exception(route);
}
if let Some(new_key) = new_key {
self.akey = new_key;
}
if reset_security_stamp {
self.reset_security_stamp()
}