From 7c28217c765d9bf370cfb691bbe12f4ee39b573e Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 18 May 2011 19:44:24 +0200 Subject: App/Raps2/Password: salt: Always return --- lib/App/Raps2/Password.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/App/Raps2/Password.pm b/lib/App/Raps2/Password.pm index 73eee32..ef24a65 100644 --- a/lib/App/Raps2/Password.pm +++ b/lib/App/Raps2/Password.pm @@ -103,22 +103,22 @@ sub create_salt { =item $pass->salt([I]) -Gets/Sets the currently used salt. +Returns the currently used salt and optionally changes it to I. =cut sub salt { my ($self, $salt) = @_; - if (not defined $salt) { - return $self->{salt}; - } + if (defined $salt) { + if (length($salt) != 16) { + confess('incorrect salt length'); + } - if (length($salt) != 16) { - confess('incorrect salt length'); + $self->{salt} = $salt; } - $self->{salt} = $salt; + return $self->{salt}; } =item $pass->encrypt(I) -- cgit v1.2.3