aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorStefan Kangas <skangas@skangas.se>2011-03-12 18:10:01 +0100
committerStefan Kangas <skangas@skangas.se>2011-03-12 18:12:31 +0100
commit921a99c5e31c3402551e79c0678ebed17d26ac5b (patch)
treeab0698d55a5cb455dcb1521b1c675c83b9086bdd /lib
parent2b9012f0d2631a6a6705fbe914f6cb8223d3d2e1 (diff)
User must verify password once
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Fripost/Prompt.pm15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Fripost/Prompt.pm b/lib/Fripost/Prompt.pm
index a857cc1..f7db34c 100755
--- a/lib/Fripost/Prompt.pm
+++ b/lib/Fripost/Prompt.pm
@@ -30,9 +30,20 @@ sub fix_username {
}
sub prompt_password {
- my $prompt = shift;
+ my ($prompt, $prompt2) = @_;
$prompt //= "Enter new password (blank for random): ";
- my $password = prompt $prompt, -e => '*';
+ $prompt2 //= "Enter new password again (blank for random): ";
+
+ my $password;
+ while (not defined $password) {
+ $password = prompt $prompt, -e => '*';
+ my $confirm = prompt $prompt2, -e => '*';
+ unless ($password eq $confirm) {
+ undef $password;
+ say "Passwords do not match";
+ }
+ }
+
if (!length $password) {
$password = mkpasswd(
-length => 10,