Add IRC Nickname field to login page, take two.

This commit is contained in:
zach%zachlipton.com 2006-01-19 00:03:31 +00:00
parent b52ad88662
commit 535505b34d
6 changed files with 25 additions and 4 deletions

View File

@ -185,6 +185,7 @@ sub processLoginForm {
my $email = $c->param("email");
my $name = $c->param("realname");
my $password = $c->param("password");
my $nickname = $c->param("irc_nickname");
# some basic form-field validation:
my $emailregexp = q:^[\\w\\.\\+\\-=]+@[\\w\\.\\-]+\\.[\\w\\-]+$:;
@ -208,7 +209,9 @@ sub processLoginForm {
bugzilla_uid => 0,
realname => $name,
disabled => 0,
is_admin => 0});
is_admin => 0,
irc_nickname => $nickname
});
my $session = makeSession($userobj);
$c->storeCookie(makeCookie($session));
@ -267,6 +270,7 @@ sub processLoginForm {
my $realname = $c->param("realname");
my $password = $c->param("password");
my $password_confirm = $c->param("password_confirm");
my $nickname = $c->param("irc_nickname");
if (! $password eq $password_confirm) {
loginError($c, "Passwords do not match. Please try again.");
@ -284,7 +288,8 @@ sub processLoginForm {
create a new account.");
}
if ($userobj->password() ne "") {
if ($userobj->password() ne "" && ($userobj->bugzilla_uid() == 0 ||
!$userobj->bugzilla_uid())) {
# already a new-style account
loginError($c, "User $username has already been updated. Please
go ahead and login normally or create a new account.");
@ -296,6 +301,7 @@ sub processLoginForm {
$userobj->realname($realname);
$userobj->disabled(0);
$userobj->is_admin(0);
$userobj->irc_nickname($nickname);
$userobj->update();
my $session = makeSession($userobj);

View File

@ -38,7 +38,7 @@ use base 'Litmus::DBI';
Litmus::DB::User->table('users');
Litmus::DB::User->columns(All => qw/user_id bugzilla_uid email password realname
disabled is_admin/);
irc_nickname disabled is_admin/);
Litmus::DB::User->column_alias("user_id", "userid");
Litmus::DB::User->column_alias("is_trusted", "istrusted");

View File

@ -135,6 +135,7 @@ $dbtool->AddField("users", "password", "varchar(255)");
$dbtool->AddField("users", "realname", "varchar(255)");
$dbtool->AddField("users", "disabled", "mediumtext");
$dbtool->AddField("users", "is_admin", "tinyint(1) default '0'");
$dbtool->AddField("users", "irc_nickname", "varchar(32)");
# replace enums with more portable and flexible formats:
$dbtool->ChangeFieldType("products", "enabled", 'tinyint default \'1\'');

View File

@ -21,6 +21,10 @@
# Litmus database schema
# IMPORTANT: Any changes (other than new tables) made here must also be made
# by adding --TABLE-- upgrading code to populatedb.pl to handle upgrades from
# previous versions of the schema.
our $table;
$table{branches} =
@ -247,6 +251,7 @@ $table{users} =
email varchar(255),
password varchar(255),
realname varchar(255),
irc_nickname varchar(32),
disabled mediumtext,
is_admin tinyint(1),

View File

@ -83,6 +83,10 @@
<td><input name="realname" type="text" size="25"></td>
</tr>
<tr>
<td>IRC Nickname (optional):</td>
<td><input name="irc_nickname" type="text" size="25"></td>
</tr>
<tr>
<td>New Password:</td>
<td><input name="password" type="password" size="25"></td>
</tr>

View File

@ -95,7 +95,12 @@
</tr><tr>
<td>Real Name:</td>
<td><input name="realname" type="text" size="25"></td>
</tr><tr>
</tr>
<tr>
<td>IRC Nickname (optional):</td>
<td><input name="irc_nickname" type="text" size="25"></td>
</tr>
<tr>
<td>Password:</td>
<td><input name="password" type="password" size="25"></td>
</tr><tr>