]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 327355: Email preferences are not set correctly when the user account is created...
authorlpsolit%gmail.com <>
Wed, 22 Feb 2006 00:15:41 +0000 (00:15 +0000)
committerlpsolit%gmail.com <>
Wed, 22 Feb 2006 00:15:41 +0000 (00:15 +0000)
Bugzilla/Auth/Login/WWW/Env.pm
Bugzilla/User.pm

index 64487884c0753cdb22d68eaddc1ed92368c0eaac..f1f72ca30df87ae7e9680e2d39ce33f2d32455a7 100644 (file)
@@ -26,6 +26,7 @@ use strict;
 use Bugzilla::Config;
 use Bugzilla::Error;
 use Bugzilla::Util;
+use Bugzilla::User;
 
 sub login {
     my ($class, $type) = @_;
@@ -117,12 +118,9 @@ sub login {
                 # Need to create a new user with that email address.  Note
                 # that cryptpassword has been filled in with '*', since the
                 # user has no DB password.
-                $sth = $dbh->prepare("INSERT INTO profiles ( " .
-                                     "login_name, cryptpassword, " .
-                                     "realname, disabledtext " .
-                                     ") VALUES ( ?, ?, ?, '' )");
-                $sth->execute($env_email, '*', $env_realname);
-                $matched_userid = $dbh->bz_last_key('profiles', 'userid');
+                insert_new_user($env_email, $env_realname, '*');
+                my $new_user = Bugzilla::User->new_from_login($env_email);
+                $matched_userid = $new_user->id;
                 $new_login_name = $matched_userid;
             }
         }
index 19c45cbed9e69e6f04ffffc941b8b411e3539ea7..7288ab30e82f4d62c2310e6e95c89b49c3005829 100644 (file)
@@ -1304,8 +1304,10 @@ sub insert_new_user {
     $disabledtext ||= '';
 
     # If not specified, generate a new random password for the user.
+    # If the password is '*', do not encrypt it; we are creating a user
+    # based on the ENV auth method.
     $password ||= generate_random_password();
-    my $cryptpassword = bz_crypt($password);
+    my $cryptpassword = ($password ne '*') ? bz_crypt($password) : $password;
 
     # XXX - These should be moved into is_available_username or validate_email_syntax
     #       At the least, they shouldn't be here. They're safe for now, though.