mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 10:12:25 -05:00
passwd: Prompt for the current password before setting new password
This changes passwd to authenticate non-root users before prompting for new password.
This commit is contained in:
parent
96588adbd4
commit
b0f8bccd08
Notes:
sideshowbarker
2024-07-18 12:06:55 +09:00
Author: https://github.com/brapru Commit: https://github.com/SerenityOS/serenity/commit/b0f8bccd08c Pull-request: https://github.com/SerenityOS/serenity/pull/7454 Reviewed-by: https://github.com/awesomekling
1 changed files with 13 additions and 0 deletions
|
@ -84,6 +84,19 @@ int main(int argc, char** argv)
|
|||
} else if (unlock) {
|
||||
target_account.set_password_enabled(true);
|
||||
} else {
|
||||
if (current_uid != 0) {
|
||||
auto current_password = Core::get_password("Current password: ");
|
||||
if (current_password.is_error()) {
|
||||
warnln("{}", current_password.error());
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!target_account.authenticate(current_password.value().characters())) {
|
||||
warnln("Incorrect or disabled password.");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
auto new_password = Core::get_password("New password: ");
|
||||
if (new_password.is_error()) {
|
||||
warnln("{}", new_password.error());
|
||||
|
|
Loading…
Add table
Reference in a new issue