From f8985bf45453885c39778b58a4df359f7283499b Mon Sep 17 00:00:00 2001 From: npze Date: Sun, 15 Jun 2014 11:55:26 +0200 Subject: [PATCH] Save HTTP AUTH password to DB on every login --- source/plugins/auth_remote/init.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/plugins/auth_remote/init.php b/source/plugins/auth_remote/init.php index 2ec2c87..0311348 100644 --- a/source/plugins/auth_remote/init.php +++ b/source/plugins/auth_remote/init.php @@ -69,6 +69,14 @@ 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 + $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;