1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ttrss_ynh.git synced 2024-10-01 13:34:46 +02:00

add update user password

This commit is contained in:
root 2014-12-16 17:23:09 +00:00
parent d2c60adbba
commit be68ae4975

View file

@ -69,6 +69,16 @@ class Auth_Remote extends Plugin implements IAuthModule {
db_query("UPDATE ttrss_users SET email = '$email' WHERE id = " .
$user_id);
}
// update user password to allow api access
if (isset($_SERVER['PHP_AUTH_PW']){
$currentpassword = $_SERVER['PHP_AUTH_PW'];
$new_salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
$new_password_hash = encrypt_password($currentpassword, $new_salt, true);
db_query("UPDATE ttrss_users SET
pwd_hash = '$new_password_hash', salt = '$new_salt', otp_enabled = false
WHERE login = '$try_login'");
}
}
return $user_id;