[vhffs-dev] [2202] Vhffs::Services::Mail:: add_box is now supporting cleartext and already hashed password

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 2202
Author:   gradator
Date:     2012-07-15 18:01:49 +0200 (Sun, 15 Jul 2012)
Log Message:
-----------
Vhffs::Services::Mail::add_box is now supporting cleartext and already hashed password

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Services/Mail.pm

Modified: trunk/vhffs-api/src/Vhffs/Services/Mail.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Mail.pm	2012-07-10 09:35:40 UTC (rev 2201)
+++ trunk/vhffs-api/src/Vhffs/Services/Mail.pm	2012-07-15 16:01:49 UTC (rev 2202)
@@ -1404,6 +1404,7 @@
 	my $self = shift;
 	my $localpart = shift;
 	my $password = shift;
+	my $ishashed = shift;
 
 	# $localpart is checked by Localpart class
 
@@ -1413,8 +1414,6 @@
 	return undef if defined $lp and defined $lp->{box};
 	my $box;
 
-	$password = password_encrypt( $password );
-
 	my $dbh = $self->get_db;
 	local $dbh->{RaiseError} = 1;
 	local $dbh->{PrintError} = 0;
@@ -1428,7 +1427,11 @@
 		}
 		# if localpart exists, update the password
 		else {
-			$lp->set_password( $password );
+			unless( $ishashed ) {
+				$lp->set_password( $password );
+			} else {
+				$lp->{password} = $password;
+			}
 			$lp->commit
 		}
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/