summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-07-20 19:04:29 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-07-20 19:04:29 +0200
commitd40f159f56eb098a9ddf082ebd64b414e2e8801d (patch)
tree3e67810231a553b13265bf246e3959aabe73eb78 /bin
parentf5ebcadaae26ef13e4bdd47af63cb6056a43e25d (diff)
raps2 add: Use pwgen to generate password if the user didn't specify one
Diffstat (limited to 'bin')
-rwxr-xr-xbin/raps210
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/raps2 b/bin/raps2
index 02d0bf0..90d094f 100755
--- a/bin/raps2
+++ b/bin/raps2
@@ -62,6 +62,16 @@ sub cmd_add {
my $pass = $raps2->ui->read_pw( 'Password', 1 );
my $extra = $raps2->ui->read_multiline('Additional content');
+ if ( length($pass) == 0 ) {
+ $pass = $raps2->generate_password();
+
+ if ( not $pass ) {
+ say STDERR "Password generation failed: ${!}: "
+ . $raps2->conf('pwgen_cmd');
+ exit 3;
+ }
+ }
+
$raps2->pw_save(
file => $pwfile,
url => $url,