1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:17:44 +00:00

passwd: Retype password to confirm

Previously passwd would accept the first password input by the user. It
should ask the user to re-type the password to check for mismatches and
prevent typos in the password.
This commit is contained in:
brapru 2021-05-24 15:50:56 -04:00 committed by Andreas Kling
parent b0f8bccd08
commit 4fd842f566

View file

@ -103,6 +103,17 @@ int main(int argc, char** argv)
return 1; return 1;
} }
auto new_password_retype = Core::get_password("Retype new password: ");
if (new_password_retype.is_error()) {
warnln("{}", new_password_retype.error());
return 1;
}
if (new_password.value() != new_password_retype.value()) {
warnln("Sorry, passwords don't match.");
return 1;
}
target_account.set_password(new_password.value().characters()); target_account.set_password(new_password.value().characters());
} }