use Bugzilla::Config;
use Bugzilla::Error;
use Bugzilla::Util;
+use Bugzilla::User;
sub login {
my ($class, $type) = @_;
# 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;
}
}
}
$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.