diff options
author | Gustav Eek <gustaveek@student.gu.se> | 2011-03-13 21:21:34 +0100 |
---|---|---|
committer | Gustav Eek <gustaveek@student.gu.se> | 2011-03-13 21:21:34 +0100 |
commit | f5b35afdbddc2305561402e69e9b11cbe2b82799 (patch) | |
tree | 1a7e136c7b5213039ad206a091f8ffc2e068ea9b /lib/Fripost | |
parent | ef24b4855b5fa09a5e86a8eb75a3aaf0f1a2822b (diff) | |
parent | 99411e118c9353e9ace7508059dfea0f708963e2 (diff) |
Merge branch 'master' of https://github.com/skangas/fripost-tools
Diffstat (limited to 'lib/Fripost')
-rwxr-xr-x | lib/Fripost/Prompt.pm | 15 |
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, |