mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-26 15:29:21 +00:00
Can change user password
This commit is contained in:
parent
9c8116f9bd
commit
6c7fa3afa5
@ -101,6 +101,8 @@ pub fn get_routes() -> Vec<Route> {
|
||||
Route::post("/settings/get_security", Box::new(settings_controller::get_security)),
|
||||
Route::post("/settings/set_security", Box::new(settings_controller::set_security)),
|
||||
Route::post("/settings/check_password", Box::new(settings_controller::check_password)),
|
||||
Route::post("/settings/update_password", Box::new(settings_controller::update_password)),
|
||||
|
||||
|
||||
// Friends controller
|
||||
Route::post("/friends/getList", Box::new(friends_controller::get_list)),
|
||||
|
@ -123,4 +123,15 @@ pub fn check_password(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
r.need_user_password("password")?;
|
||||
|
||||
r.success("The password is valid.")
|
||||
}
|
||||
|
||||
/// Update user password
|
||||
pub fn update_password(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
r.need_user_password("oldPassword")?;
|
||||
|
||||
let new_password = r.post_string("newPassword")?;
|
||||
|
||||
account_helper::change_password(r.user_id_ref()?, &new_password)?;
|
||||
|
||||
r.success("Password updated !")
|
||||
}
|
Loading…
Reference in New Issue
Block a user