summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-07-04 13:01:17 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-07-04 13:01:17 +0200
commitafebe00e35d17c3b2de1317be73fd9c89f1776b5 (patch)
treefab540c78fafe82831efcdab7ae6973c02a533a6
parent8cffad05c11af59975137aa6dc2981ccc510f48d (diff)
Raps2.pm: Fix internal master_password handling from new + previous sed fuckup
-rw-r--r--lib/App/Raps2.pm13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/App/Raps2.pm b/lib/App/Raps2.pm
index 96698d8..878ba9d 100644
--- a/lib/App/Raps2.pm
+++ b/lib/App/Raps2.pm
@@ -17,7 +17,7 @@ sub new {
my ( $class, %opt ) = @_;
my $self = {};
- $self->{xdg_opt} = config_home('raps2');
+ $self->{xdg_conf} = config_home('raps2');
$self->{xdg_data} = data_home('raps2');
$self->{ui} = App::Raps2::UI->new();
@@ -28,7 +28,7 @@ sub new {
if ( not $opt{dont_touch_fs} ) {
$self->sanity_check();
- $self->load_optig();
+ $self->load_config();
}
if ( $opt{master_password} ) {
@@ -74,7 +74,7 @@ sub get_master_password {
}
$self->{pass} = App::Raps2::Password->new(
- cost => $self->{default}->{cost},
+ cost => $self->{default}{cost},
salt => $self->{master_salt},
passphrase => $pass,
);
@@ -86,8 +86,9 @@ sub get_master_password {
sub create_config {
my ($self) = @_;
- my $cost = 12;
- my $pass = $self->ui->read_pw( 'Master Password', 1 );
+ my $cost = 12;
+ my $pass = $self->{default}{master_password}
+ // $self->ui->read_pw( 'Master Password', 1 );
$self->{pass} = App::Raps2::Password->new(
cost => $cost,
@@ -111,7 +112,7 @@ sub load_config {
my $cfg = $self->file_to_hash( $self->{xdg_conf} . '/password' );
$self->{master_hash} = $cfg->{hash};
$self->{master_salt} = $cfg->{salt};
- $self->{default}->{cost} //= $cfg->{cost};
+ $self->{default}{cost} //= $cfg->{cost};
return;
}