]> git.proxmox.com Git - pve-common.git/commitdiff
add a generalized 'read and confirm password' sub
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 12 Jun 2018 10:33:47 +0000 (12:33 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 12 Jun 2018 12:59:16 +0000 (14:59 +0200)
to use everywhere we read two passwords and compare them

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/PVE/PTY.pm

index 23d76c0d02f9028d1b394ff32d5e8b6bb4fbf369..e433c4ec442a6cfdd1fae24e242ce1432215b760 100644 (file)
@@ -228,6 +228,13 @@ sub read_password($;$$) {
     return $password;
 }
 
+sub get_confirmed_password {
+    my $pw1 = read_password('Enter new password: ');
+    my $pw2 = read_password('Retype new password: ');
+    die "passwords do not match\n" if $pw1 ne $pw2;
+    return $pw1;
+}
+
 # Class functions
 
 sub new {