From 2d642a6de9064d38bcaca2c16a38b57bcd103437 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Wed, 22 Feb 2006 00:19:57 +0000 Subject: [PATCH] =?utf8?q?Bug=20327355:=20Email=20preferences=20are=20not?= =?utf8?q?=20set=20correctly=20when=20the=20user=20account=20is=20created?= =?utf8?q?=20by=20Env.pm=20-=20Patch=20by=20Fr=C3=A9d=C3=A9ric=20Buclin=20?= =?utf8?q?=20r=3Djoel=20a=3Djustdave?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Bugzilla/Auth/Login/WWW/Env.pm | 10 ++++------ Bugzilla/User.pm | 4 +++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Bugzilla/Auth/Login/WWW/Env.pm b/Bugzilla/Auth/Login/WWW/Env.pm index 39bea28dfd..105444ef00 100644 --- a/Bugzilla/Auth/Login/WWW/Env.pm +++ b/Bugzilla/Auth/Login/WWW/Env.pm @@ -26,6 +26,7 @@ use strict; use Bugzilla::Config; use Bugzilla::Error; use Bugzilla::Util; +use Bugzilla::User; sub login { my ($class, $type) = @_; @@ -116,12 +117,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; } } } diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 909511ca24..7f2bff4c53 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -1194,8 +1194,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 ||= &::GenerateRandomPassword(); - my $cryptpassword = bz_crypt($password); + my $cryptpassword = ($password ne '*') ? bz_crypt($password) : $password; # XXX - These should be moved into ValidateNewUser or CheckEmailSyntax # At the least, they shouldn't be here. They're safe for now, though. -- 2.47.2