| Line 7... |
Line 7... |
| 7 |
#warn "Redirecting errors to ${error_log_path}vorc_error.log";
|
7 |
#warn "Redirecting errors to ${error_log_path}vorc_error.log";
|
| Line 8... |
Line 8... |
| 8 |
|
8 |
|
| 9 |
use strict;
|
9 |
use strict;
|
| 10 |
use cPanelUserConfig;
|
10 |
use cPanelUserConfig;
|
| - |
|
11 |
use RollerCon;
|
| 11 |
use RollerCon;
|
12 |
use tableViewer qw/inArray/;
|
| 12 |
use CGI qw/param cookie header start_html url/;
|
13 |
use CGI qw/param cookie header start_html url/;
|
| 13 |
use Email::Valid;
|
14 |
use Email::Valid;
|
| 14 |
use WebDB;
|
15 |
use WebDB;
|
| 15 |
use HTML::Tiny;
|
16 |
use HTML::Tiny;
|
| Line 16... |
Line 17... |
| 16 |
our $h = HTML::Tiny->new( mode => 'html' );
|
17 |
our $h = HTML::Tiny->new( mode => 'html' );
|
| 17 |
|
18 |
|
| 18 |
my ($FORM, $cookie_string, $ERRMSG);
|
19 |
my ($FORM, $cookie_string, $ERRMSG);
|
| 19 |
my @ERRORS;
|
- |
|
| 20 |
my $dbh = getRCDBH;
|
20 |
my @ERRORS;
|
| 21 |
#my $dbh = WebDB->connect ();
|
21 |
my $dbh = getRCDBH;
|
| 22 |
my $depts = getDepartments (); # HashRef of the department TLAs -> Display Names...
|
22 |
my $depts = getDepartments (); # HashRef of the department TLAs -> Display Names...
|
| 23 |
my $deptDesc = getDepartmentDescriptions ();
|
23 |
my $deptDesc = getDepartmentDescriptions ();
|
| 24 |
my $deptLink = getDepartmentLinks ();
|
24 |
my $deptLink = getDepartmentLinks ();
|
| 25 |
my $AccessLevel = getAccessLevels;
|
25 |
my $AccessLevel = getAccessLevels;
|
| - |
|
26 |
my @tshirtOptions = ("", "MS", "MM", "ML", "MXL", "M2X", "M3X");
|
| - |
|
27 |
my @AUTODEPTS = map { $_->[0] } @{$dbh->selectall_arrayref ("select TLA from department where autoapprove = true")};
|
| - |
|
28 |
my @FIELDS = qw/ derby_name email real_name phone password access department tshirt pronouns timeformat /;
|
| - |
|
29 |
my @PRIVFIELDS = qw/ email access /;
|
| Line 26... |
Line 30... |
| 26 |
my @tshirtOptions = ("", "MS", "MM", "ML", "MXL", "M2X", "M3X");
|
30 |
$ORCUSER->{department} = ref $ORCUSER->{department} eq "HASH" ? $ORCUSER->{department} : convertDepartments($ORCUSER->{department});
|
| 27 |
my @AUTODEPTS = map { $_->[0] } @{$dbh->selectall_arrayref ("select TLA from department where autoapprove = true")};
|
31 |
|
| 28 |
|
32 |
|
| 29 |
# The page's form might be submitted as a POST or a GET (or both?)
|
33 |
# The page's form might be submitted as a POST or a GET (or both?)
|
| Line 78... |
Line 82... |
| 78 |
$F->{real_name} = WebDB::trim param ('real_name') // '';
|
82 |
$F->{real_name} = WebDB::trim param ('real_name') // '';
|
| 79 |
$F->{pronouns} = WebDB::trim param ('pronouns') // '';
|
83 |
$F->{pronouns} = WebDB::trim param ('pronouns') // '';
|
| 80 |
$F->{tshirt} = WebDB::trim param ('tshirt') // '';
|
84 |
$F->{tshirt} = WebDB::trim param ('tshirt') // '';
|
| 81 |
$F->{phone} = WebDB::trim param ('phone') // '';
|
85 |
$F->{phone} = WebDB::trim param ('phone') // '';
|
| 82 |
$F->{timeformat} = WebDB::trim param ('timeformat') // '24hr';
|
86 |
$F->{timeformat} = WebDB::trim param ('timeformat') // '24hr';
|
| 83 |
# $F->{level} = param ('level') // '';
|
- |
|
| 84 |
# $F->{type} = param ('type') // '';
|
- |
|
| 85 |
$F->{RCid} = param ('RCid') // '';
|
87 |
$F->{RCid} = param ('RCid') // '';
|
| 86 |
$F->{access} = param ('access') // 0;
|
88 |
$F->{access} = param ('access') // 0;
|
| 87 |
# $F->{mvp_pass} = defined param ('mvp_pass') ? 1 : 0;
|
- |
|
| 88 |
$F->{department} = join ":", map { "$_-".param ("DEPT-".$_) } map { s/^DEPT-//; $_ } grep { param ($_) ne "" } grep { /^DEPT-/ } param ;
|
89 |
$F->{department} = join ":", map { "$_-".param ("DEPT-".$_) } map { s/^DEPT-//; $_ } grep { param ($_) ne "" } grep { /^DEPT-/ } param ;
|
| Line 89... |
Line 90... |
| 89 |
|
90 |
|
| 90 |
if ($F->{RCid} eq "New") {
|
91 |
if ($F->{RCid} eq "New") {
|
| 91 |
# Saving a new User...
|
92 |
# Saving a new User...
|
| 92 |
# But first let's do some error checking...0
|
93 |
# But first let's do some error checking...0
|
| 93 |
if (!$F->{password}) { push @ERRORS, "Blank Password!"; }
|
94 |
if (!$F->{password}) { push @ERRORS, "Blank Password!"; }
|
| 94 |
if (!$F->{real_name}) { push @ERRORS, "Blank Full Name!"; }
|
95 |
if (!$F->{real_name}) { push @ERRORS, "Blank Full Name!"; }
|
| 95 |
if (!$F->{derby_name}) { $F->{derby_name} = $F->{real_name}; } # If they leave derby_name blank, use their real_name
|
96 |
if (!$F->{derby_name}) { $F->{derby_name} = $F->{real_name}; } # If they leave derby_name blank, use their real_name
|
| 96 |
if (checkDupes ('derby_name', $F->{derby_name})) { push @ERRORS, "Derby Name already in use. Pick a different one."; $F->{derby_name} = ""; }
|
- |
|
| 97 |
# if (!$F->{level}) { $F->{level} = "B"; } # People keep leaving level blank. Default 'em if they do.
|
- |
|
| 98 |
# if (!$F->{type}) { $F->{type} = "official"; } # and now they left the other drop-down blank!!!
|
97 |
if (checkDupes ('derby_name', $F->{derby_name})) { push @ERRORS, "Derby Name already in use. Pick a different one."; $F->{derby_name} = ""; }
|
| 99 |
if (!$F->{email}) { push @ERRORS, "Blank Email (User-ID)!"; } else {
|
98 |
if (!$F->{email}) { push @ERRORS, "Blank Email (User-ID)!"; } else {
|
| 100 |
$F->{email} =~ s/\s+//g; # make sure people aren't accidentally including spaces
|
99 |
$F->{email} =~ s/\s+//g; # make sure people aren't accidentally including spaces
|
| 101 |
$F->{email} = lc $F->{email}; # sometimes people capitalize their email addresses and that's annoying...
|
100 |
$F->{email} = lc $F->{email}; # sometimes people capitalize their email addresses and that's annoying...
|
| 102 |
if (! Email::Valid->address (-address => $F->{email}, -mxcheck => 1, -tldcheck => 1)) { push @ERRORS, "Mal-formatted (or fake) Email Address!"; $F->{email} = ""; }
|
101 |
if (! Email::Valid->address (-address => $F->{email}, -mxcheck => 1, -tldcheck => 1)) { push @ERRORS, "Mal-formatted (or fake) Email Address!"; $F->{email} = ""; }
|
| 103 |
}
|
102 |
}
|
| 104 |
if (checkDupes ('email', $F->{email})) { push @ERRORS, "Email Address already in use. Pick a different one."; $F->{email} = ""; }
|
- |
|
| Line 105... |
Line 103... |
| 105 |
# if (!$F->{department}) { push @ERRORS, "You need to request at least one Department!"; }
|
103 |
if (checkDupes ('email', $F->{email})) { push @ERRORS, "Email Address already in use. Pick a different one."; $F->{email} = ""; }
|
| 106 |
|
104 |
|
| 107 |
if (scalar @ERRORS) {
|
105 |
if (scalar @ERRORS) {
|
| 108 |
$ERRMSG = join $h->br, @ERRORS;
|
- |
|
| 109 |
display_form ("New", "New User", $ERRMSG, $F);
|
106 |
$ERRMSG = join $h->br, @ERRORS;
|
| 110 |
return;
|
107 |
display_form ("New", "New User", $ERRMSG, $F);
|
| Line 111... |
Line 108... |
| 111 |
} else {
|
108 |
} else {
|
| 112 |
# We have a correctly formatted email address with a mail host record, go ahead and add the user
|
109 |
# We have a correctly formatted email address with a mail host record, go ahead and add the user
|
| 113 |
|
- |
|
| 114 |
# Check to see if any of the departments they've requested are set to autoapprove.
|
110 |
|
| 115 |
$F->{department} = convertDepartments $F->{department};
|
111 |
# Check to see if any of the departments they've requested are set to autoapprove.
|
| Line 116... |
Line 112... |
| 116 |
use tableViewer;
|
112 |
$F->{department} = convertDepartments $F->{department};
|
| 117 |
map { $F->{department}->{$_} = inArray ($_, \@AUTODEPTS) } keys %{$F->{department}};
|
113 |
map { $F->{department}->{$_} = inArray ($_, \@AUTODEPTS) } keys %{$F->{department}};
|
| 118 |
$F->{department} = convertDepartments $F->{department};
|
- |
|
| 119 |
|
114 |
$F->{department} = convertDepartments $F->{department};
|
| 120 |
# my $sth = $dbh->prepare ("insert into official (email, password, derby_name, real_name, phone, level, type, access, department, clinic_pass) values (?, password(?), ?, ?, ?, ?, ?, ?, ?, ?)");
|
- |
|
| Line 121... |
Line 115... |
| 121 |
my $sth = $dbh->prepare ("insert into official (email, password, derby_name, real_name, pronouns, tshirt, phone, timeformat, access, department, added, activation) values (?, password(?), ?, ?, ?, ?, ?, ?, ?, ?, CONVERT_TZ(now(), 'America/Chicago', 'America/Los_Angeles'), md5(rand()))");
|
115 |
|
| 122 |
|
- |
|
| 123 |
# $sth->execute ($F->{email}, $F->{password}, $F->{derby_name}, $F->{real_name}, $F->{phone}, $F->{level}, $F->{type}, 0, $F->{department}, 0);
|
- |
|
| - |
|
116 |
$dbh->do ("insert into official (email, password, derby_name, real_name, pronouns, tshirt, phone, timeformat, access, department, added, activation) values (?, password(?), ?, ?, ?, ?, ?, ?, ?, ?, CONVERT_TZ(now(), 'America/Chicago', 'America/Los_Angeles'), md5(rand()))", undef,
|
| 124 |
$sth->execute ($F->{email}, $F->{password}, $F->{derby_name}, $F->{real_name}, $F->{pronouns}, $F->{tshirt}, $F->{phone}, $F->{timeformat}, 0, $F->{department});
|
117 |
$F->{email}, $F->{password}, $F->{derby_name}, $F->{real_name}, $F->{pronouns}, $F->{tshirt}, $F->{phone}, $F->{timeformat}, 0, $F->{department})
|
| 125 |
|
118 |
or display_form ("New", "New User", "ERROR: DB: ".$dbh->errstr, $F);
|
| 126 |
$sth = $dbh->prepare ("select RCid, activation from official where email = ?");
|
119 |
|
| 127 |
$sth->execute ($F->{email});
|
120 |
($F->{RCid}, $F->{activation}) = @{$dbh->selectall_arrayref ("select RCid, activation from official where email = ?", undef, $F->{email})};
|
| 128 |
($F->{RCid}, $F->{activation}) = $sth->fetchrow_array;
|
121 |
|
| 129 |
$dbh->do ("replace into RCid_ticket_link select official.RCid, v_ticket.id from official join v_ticket on official.email = v_ticket.email and official.real_name = v_ticket.full_name where official.RCid = ?", undef, $F->{RCid});
|
122 |
$dbh->do ("replace into RCid_ticket_link select official.RCid, v_ticket.id from official join v_ticket on official.email = v_ticket.email and official.real_name = v_ticket.full_name where official.RCid = ?", undef, $F->{RCid});
|
| - |
|
123 |
logit ($F->{RCid}, "New User Registration");
|
| 130 |
logit ($F->{RCid}, "New User Registration");
|
124 |
sendNewUserEMail ("New User", $F);
|
| 131 |
sendNewUserEMail ("New User", $F);
|
125 |
$cookie_string = authenticate (RollerCon::USER);
|
| Line 132... |
Line 126... |
| 132 |
$cookie_string = authenticate (1);
|
126 |
}
|
| - |
|
127 |
} else {
|
| 133 |
}
|
128 |
# Save changes to an existing user.
|
| 134 |
} else {
|
129 |
$cookie_string = authenticate (RollerCon::USER);
|
| 135 |
$cookie_string = authenticate (1);
|
130 |
my ($EM, $PWD, $AL) = split /&/, $cookie_string;
|
| - |
|
131 |
|
| 136 |
my ($EM, $PWD, $AL) = split /&/, $cookie_string;
|
132 |
my $OG = getUser ($F->{RCid});
|
| 137 |
|
133 |
|
| 138 |
my $OG = getUser ($F->{RCid});
|
134 |
if ($F->{derby_name} ne $OG->{derby_name} and checkDupes ('derby_name', $F->{derby_name})) { push @ERRORS, "Derby Name already in use. Pick a different one."; $F->{derby_name} = ""; }
|
| 139 |
if ($F->{derby_name} ne $OG->{derby_name} and checkDupes ('derby_name', $F->{derby_name})) { push @ERRORS, "Derby Name already in use. Pick a different one."; $F->{derby_name} = ""; }
|
- |
|
| 140 |
if ($F->{email} ne $OG->{email} and checkDupes ('email', $F->{email})) { push @ERRORS, "Email Address already in use. Pick a different one."; $F->{email} = ""; }
|
135 |
if ($F->{email} ne $OG->{email} and checkDupes ('email', $F->{email})) { push @ERRORS, "Email Address already in use. Pick a different one."; $F->{email} = ""; }
|
| Line -... |
Line 136... |
| - |
|
136 |
if (!$F->{real_name}) { push @ERRORS, "Blank Full Name!"; }
|
| - |
|
137 |
|
| - |
|
138 |
if (scalar @ERRORS) {
|
| 141 |
if (!$F->{real_name}) { push @ERRORS, "Blank Full Name!"; }
|
139 |
$ERRMSG = join $h->br, @ERRORS;
|
| Line 142... |
Line -... |
| 142 |
if (scalar @ERRORS) {
|
- |
|
| 143 |
$ERRMSG = join $h->br, @ERRORS;
|
- |
|
| 144 |
display_form ($F->{RCid}, "Edit", $ERRMSG, $F);
|
140 |
display_form ($F->{RCid}, "Edit", $ERRMSG, $F);
|
| 145 |
return;
|
141 |
}
|
| 146 |
}
|
142 |
|
| 147 |
|
143 |
|
| 148 |
if (lc $EM eq lc $F->{email} and $AL < 5) { # They're editing their own record (and not a sysadmin).
|
144 |
|
| 149 |
|
145 |
if ($ORCUSER->{RCid} == $F->{RCid} or $AL >= RollerCon::SYSADMIN) {
|
| 150 |
# Don't let users change their own mvp_pass setting...
|
- |
|
| 151 |
# $F->{mvp_pass} = getUser($EM)->{mvp_pass};
|
146 |
# They're editing their own record (or a sysadmin).
|
| 152 |
my $DBDepts = getUser($EM)->{department};
|
147 |
|
| 153 |
if ($F->{department} ne $DBDepts) {
|
148 |
my $DBDepts = $OG->{department};
|
| 154 |
# They're trying to change one of their own departments.
|
149 |
if ($F->{department} ne $DBDepts and $AL < RollerCon::SYSADMIN) {
|
| 155 |
my $FORMDepts = convertDepartments $F->{department};
|
150 |
# They're trying to change one of their own departments.
|
| 156 |
$DBDepts = convertDepartments $DBDepts;
|
151 |
my $FORMDepts = convertDepartments $F->{department};
|
| 157 |
# the only change to a dept should be a request to be added, some depts are auto-approved.
|
152 |
$DBDepts = convertDepartments $DBDepts;
|
| Line 158... |
Line 153... |
| 158 |
use tableViewer;
|
153 |
# the only change to a dept should be a request to be added, some depts are auto-approved.
|
| 159 |
map { $FORMDepts->{$_} = inArray ($_, \@AUTODEPTS) } keys %{$FORMDepts};
|
- |
|
| 160 |
# or they can retract their request
|
154 |
map { $FORMDepts->{$_} = inArray ($_, \@AUTODEPTS) } keys %{$FORMDepts};
|
| 161 |
map { do { delete $DBDepts->{$_} } if $DBDepts->{$_} == 0 and !defined $FORMDepts->{$_} } keys %{$DBDepts};
|
155 |
# or they can retract their request
|
| - |
|
156 |
map { do { delete $DBDepts->{$_} } if $DBDepts->{$_} == 0 and !defined $FORMDepts->{$_} } keys %{$DBDepts};
|
| 162 |
# otherwise, keep the same depts as are in the DB (or have been auto-approved...)
|
157 |
# otherwise, keep the same depts as are in the DB (or have been auto-approved...)
|
| - |
|
158 |
map { $FORMDepts->{$_} = max ($DBDepts->{$_}, $FORMDepts->{$_}) } keys %{$DBDepts};
|
| 163 |
map { $FORMDepts->{$_} = max ($DBDepts->{$_}, $FORMDepts->{$_}) } keys %{$DBDepts};
|
159 |
$F->{department} = convertDepartments $FORMDepts;
|
| 164 |
$F->{department} = convertDepartments $FORMDepts;
|
160 |
}
|
| 165 |
}
|
161 |
|
| - |
|
162 |
foreach my $field (@FIELDS) {
|
| - |
|
163 |
if ($F->{$field} eq $OG->{$field} or ($field eq "password" and !$F->{$field})) {
|
| - |
|
164 |
# No changes to this field, move on...
|
| 166 |
|
165 |
next;
|
| 167 |
if ($F->{password}) { # They've possibly included an updated password.
|
- |
|
| 168 |
# my $sth = $dbh->prepare("replace into official (RCid, email, password, derby_name, real_name, phone, level, type, access, department, clinic_pass) values (?, ?, password(?), ?, ?, ?, ?, ?, ?, ?, ?)");
|
166 |
}
|
| - |
|
167 |
|
| 169 |
# $sth->execute ($F->{RCid}, $EM, $F->{password}, $F->{derby_name}, $F->{real_name}, $F->{phone}, $F->{level}, $F->{type}, $F->{access}, $F->{department}, $F->{clinic_pass})
|
168 |
if ($AL < RollerCon::SYSADMIN and inArray ($field, \@PRIVFIELDS)) {
|
| - |
|
169 |
push @ERRORS, "ERROR: Only SysAdmins are allowed to change the $field field";
|
| 170 |
my $sth = $dbh->prepare("replace into official (RCid, email, password, derby_name, real_name, pronouns, tshirt, phone, activation, timeformat, access, department, added, last_login) values (?, ?, password(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
170 |
logit ($F->{RCid}, "SECURITY: Only SysAdmins are allowed to change the $field field");
|
| Line 171... |
Line -... |
| 171 |
$sth->execute ($F->{RCid}, lc $EM, $F->{password}, $F->{derby_name}, $F->{real_name}, $F->{pronouns}, $F->{tshirt}, $F->{phone}, getUser($EM)->{activation}, $F->{timeformat}, $F->{access}, $F->{department}, getUser($EM)->{added}, getUser($EM)->{last_login})
|
- |
|
| 172 |
or $ERRMSG = "ERROR: Can't execute SQL statement: ".$sth->errstr()."\n";
|
- |
|
| 173 |
} else { # No password was included, just keep the existing one.
|
- |
|
| 174 |
# my $sth = $dbh->prepare("replace into official (RCid, email, password, derby_name, real_name, phone, level, type, access, department, clinic_pass) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
- |
|
| 175 |
# $sth->execute($F->{RCid}, $EM, $PWD, $F->{derby_name}, $F->{real_name}, $F->{phone}, $F->{level}, $F->{type}, $F->{access}, $F->{department}, $F->{clinic_pass})
|
- |
|
| 176 |
my $sth = $dbh->prepare("replace into official (RCid, email, password, derby_name, real_name, pronouns, tshirt, phone, activation, timeformat, access, department, added, last_login) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
- |
|
| 177 |
$sth->execute($F->{RCid}, lc $EM, $PWD, $F->{derby_name}, $F->{real_name}, $F->{pronouns}, $F->{tshirt}, $F->{phone}, getUser($EM)->{activation}, $F->{timeformat}, $F->{access}, $F->{department}, getUser($EM)->{added}, getUser($EM)->{last_login})
|
171 |
next;
|
| 178 |
or $ERRMSG = "ERROR: Can't execute SQL statement: ".$sth->errstr()."\n";
|
- |
|
| 179 |
}
|
- |
|
| 180 |
|
- |
|
| 181 |
if ($ERRMSG) {
|
- |
|
| 182 |
logit ($F->{RCid}, "DB ERROR: Updating Self Details: $ERRMSG");
|
- |
|
| 183 |
} else {
|
- |
|
| 184 |
logit ($F->{RCid}, "Updated User Details");
|
- |
|
| 185 |
}
|
- |
|
| 186 |
} elsif ($AL > 1) { # A lead or higher is updating someone else's record
|
- |
|
| 187 |
|
- |
|
| 188 |
# use List::Util qw/sum/;
|
- |
|
| 189 |
# if (sum (values %{ convertDepartments ($F->{department}) }) > 0 and $F->{access} == 0) {
|
- |
|
| 190 |
# if ($F->{department} and sum (values %{ convertDepartments ($F->{department}) }) > 0 and $F->{access} == 1) {
|
- |
|
| 191 |
# activating a user for the first time...
|
- |
|
| 192 |
# $F->{access} = 1;
|
- |
|
| 193 |
# sendNewUserEMail ("Activate", $F);
|
- |
|
| 194 |
# }
|
- |
|
| 195 |
|
- |
|
| 196 |
if ($FORM->{password}) {
|
- |
|
| 197 |
# my $sth = $dbh->prepare ("replace into official (RCid, email, password, derby_name, real_name, phone, level, type, access, department, clinic_pass) values (?, ?, password(?), ?, ?, ?, ?, ?, ?, ?, ?)");
|
- |
|
| 198 |
# $sth->execute ($F->{RCid}, $F->{email}, $F->{password}, $F->{derby_name}, $F->{real_name}, $F->{phone}, $F->{level}, $F->{type}, $F->{access}, $F->{department}, $F->{clinic_pass})
|
- |
|
| 199 |
my $sth = $dbh->prepare ("replace into official (RCid, email, password, derby_name, real_name, pronouns, tshirt, phone, activation, timeformat, access, department, added, last_login) values (?, ?, password(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
- |
|
| 200 |
$sth->execute ($F->{RCid}, $F->{email}, $F->{password}, $F->{derby_name}, $F->{real_name}, $F->{pronouns}, $F->{tshirt}, $F->{phone}, getUser($F->{email})->{activation}, $F->{timeformat}, $F->{access}, $F->{department}, getUser($F->{email})->{added}, getUser($F->{email})->{last_login})
|
- |
|
| 201 |
or $ERRMSG = "ERROR: Can't execute SQL statement: ".$sth->errstr()."\n";
|
- |
|
| 202 |
} else {
|
- |
|
| 203 |
# my $sth = $dbh->prepare ("update official set email = ?, derby_name = ?, real_name = ?, phone = ?, level = ?, type = ?, access = ?, department = ?, clinic_pass = ? where RCid = ?");
|
- |
|
| 204 |
# $sth->execute ($F->{email}, $F->{derby_name}, $F->{real_name}, $F->{phone}, $F->{level}, $F->{type}, $F->{access}, $F->{department}, $F->{clinic_pass}, $F->{RCid})
|
- |
|
| 205 |
my $sth = $dbh->prepare ("update official set email = ?, derby_name = ?, real_name = ?, pronouns = ?, tshirt = ?, phone = ?, timeformat = ?, access = ?, department = ? where RCid = ?");
|
172 |
}
|
| 206 |
$sth->execute ($F->{email}, $F->{derby_name}, $F->{real_name}, $F->{pronouns}, $F->{tshirt}, $F->{phone}, $F->{timeformat}, $F->{access}, $F->{department}, $F->{RCid})
|
173 |
|
| 207 |
or $ERRMSG = "ERROR: Can't execute SQL statement: ".$sth->errstr()."\n";
|
174 |
# warn "Changing $field: $F->{$field}";
|
| 208 |
}
|
175 |
if (my $err = changeUser ($F->{RCid}, $field, $F->{$field})) {
|
| 209 |
if ($ERRMSG) {
|
176 |
push @ERRORS, $err;
|
| 210 |
logit ($F->{RCid}, "DB ERROR: Updating Someone Else: $ERRMSG");
|
177 |
logit ($F->{RCid}, "DB ERROR: Updating User Details: $err");
|
| 211 |
} else {
|
178 |
}
|
| 212 |
logit ($F->{RCid}, "Updated User Details (by ".getUser($EM)->{derby_name}.")");
|
- |
|
| 213 |
logit (getUser($EM)->{RCid}, "Updated User Details: ".$F->{derby_name}." (".$F->{RCid}.")");
|
- |
|
| 214 |
}
|
- |
|
| 215 |
} else {
|
- |
|
| 216 |
$ERRMSG = "Attempting to update someone else's record, and you don't have permission to do that.";
|
- |
|
| 217 |
logit ($F->{RCid}, "FAIL: ($EM) doesn't have access to update ($F->{email})'s record");
|
179 |
}
|
| 218 |
}
|
180 |
|
| Line -... |
Line 181... |
| - |
|
181 |
|
| - |
|
182 |
} else {
|
| - |
|
183 |
push @ERRORS, "Attempting to update someone else's record, and you don't have permission to do that.";
|
| - |
|
184 |
logit ($ORCUSER->{RCid}, "FAIL: You don't have access to update other people's user record");
|
| 219 |
}
|
185 |
}
|
| 220 |
$F->{password} = "*******";
|
186 |
}
|
| Line 221... |
Line 187... |
| 221 |
$F->{buttons} = $h->input ({ type=>"hidden", name=>"RCid", value=>$F->{RCid} }).$h->input ({ type=>"submit", name=>"submit", value=>"Edit" });
|
187 |
$F->{password} = "*******";
|
| 222 |
# if ($F->{mvp_pass}) {
|
188 |
$F->{buttons} = $h->input ({ type=>"hidden", name=>"RCid", value=>$F->{RCid} }).$h->input ({ type=>"submit", name=>"submit", value=>"Edit" });
|
| 223 |
# $F->{mvp_pass} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"mvp_pass", value=>1, readonly=>[], disabled=>[], checked=>[] }), $h->span ({ class=>"slider round" })]);
|
189 |
$F->{department} = convertDepartments ($F->{department});
|
| 224 |
# } else {
|
190 |
$dbh->do ("replace into RCid_ticket_link select official.RCid, v_ticket.id from official join v_ticket on official.email = v_ticket.email and official.real_name = v_ticket.full_name where official.RCid = ?", undef, $F->{RCid});
|
| 225 |
# $F->{mvp_pass} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"mvp_pass", value=>0, readonly=>[], disabled=>[] }), $h->span ({ class=>"slider round" })]);
|
191 |
|
| Line 226... |
Line 192... |
| 226 |
# }
|
192 |
if (scalar @ERRORS) {
|
| 227 |
$F->{department} = convertDepartments ($F->{department});
|
193 |
$ERRMSG = join $h->br, @ERRORS;
|
| 228 |
$dbh->do ("replace into RCid_ticket_link select official.RCid, v_ticket.id from official join v_ticket on official.email = v_ticket.email and official.real_name = v_ticket.full_name where official.RCid = ?", undef, $F->{RCid});
|
194 |
}
|
| 229 |
|
195 |
|
| 230 |
display_form ($F->{RCid}, "View");
|
- |
|
| 231 |
}
|
- |
|
| Line 232... |
Line -... |
| 232 |
|
- |
|
| 233 |
sub display_form {
|
196 |
display_form ($F->{RCid}, "View", $ERRMSG);
|
| 234 |
my $RCID = shift // "";
|
197 |
}
|
| 235 |
my $view = shift; # // "New User";
|
198 |
|
| 236 |
my $errors = shift // "";
|
199 |
sub display_form {
|
| 237 |
my $F = shift; # // "";
|
200 |
my $RCID = shift // "";
|
| 238 |
|
201 |
my $view = shift; # // "New User";
|
| 239 |
if ($view eq 'Edit') {
|
202 |
my $errors = shift // "";
|
| 240 |
$cookie_string = authenticate (1);
|
203 |
my $F = shift; # // "";
|
| 241 |
my ($EM, $PWD, $AL) = split /&/, $cookie_string;
|
- |
|
| 242 |
$F = getUser ($RCID);
|
204 |
|
| 243 |
my $currentuser = getUser ($EM);
|
- |
|
| 244 |
# $currentuser->{department} = convertDepartments ($currentuser->{department});
|
- |
|
| 245 |
|
205 |
if ($view eq 'Edit') {
|
| 246 |
# if (lc $EM eq lc $F->{email} or $AL > 1) {
|
- |
|
| 247 |
if (canView ($currentuser, $F)) {
|
206 |
$cookie_string = authenticate (RollerCon::USER);
|
| 248 |
# Editing your own record OR you're a lead/higher
|
207 |
my ($EM, $PWD, $AL) = split /&/, $cookie_string;
|
| 249 |
if (lc $EM eq lc $F->{email} or $currentuser->{access} < $F->{access}) {
|
208 |
$F = getUser ($RCID);
|
| 250 |
# If you're editing your own record, or someone who has higher access than you, make access level read-only
|
209 |
|
| 251 |
$F->{access} = $h->input ({ type=>"hidden", name=>"access", value=>$F->{access} }).$AccessLevel->{$F->{access}};
|
- |
|
| 252 |
} else {
|
- |
|
| 253 |
$F->{access} = $h->select ({ name=>"access" }, [map { $F->{access} == $_ ? $h->option ({ value=>$_, selected=>[] }, $AccessLevel->{$_}) : $h->option ({ value=>$_ }, $AccessLevel->{$_}) } (-1..$currentuser->{access})]);
|
- |
|
| 254 |
}
|
- |
|
| 255 |
if ($currentuser->{access} > 2) { #this would be the place to test for other types of managers that can update the MVP Pass setting
|
- |
|
| 256 |
# if ($F->{mvp_pass}) {
|
210 |
if (canView ($ORCUSER, $F)) {
|
| 257 |
# $F->{mvp_pass} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"mvp_pass", value=>1, checked=>[] }), $h->span ({ class=>"slider round" })]);
|
211 |
# Editing your own record OR you're a lead/higher
|
| 258 |
# } else {
|
212 |
if (lc $EM eq lc $F->{email} or $ORCUSER->{access} < $F->{access}) {
|
| 259 |
# $F->{mvp_pass} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"mvp_pass", value=>0 }), $h->span ({ class=>"slider round" })]);
|
213 |
# If you're editing your own record, or someone who has higher access than you, make access level read-only
|
| 260 |
# }
|
214 |
$F->{access} = $h->input ({ type=>"hidden", name=>"access", value=>$F->{access} }).$AccessLevel->{$F->{access}};
|
| 261 |
if ($F->{MVPid}) {
|
215 |
} else {
|
| 262 |
$F->{MVPid} .= "->link to change...<-";
|
216 |
$F->{access} = $h->select ({ name=>"access" }, [map { $F->{access} == $_ ? $h->option ({ value=>$_, selected=>[] }, $AccessLevel->{$_}) : $h->option ({ value=>$_ }, $AccessLevel->{$_}) } (-1..$ORCUSER->{access})]);
|
| 263 |
}
|
217 |
}
|
| 264 |
} else {
|
218 |
if ($ORCUSER->{access} >= RollerCon::MANAGER) {
|
| 265 |
# if ($F->{mvp_pass}) {
|
219 |
#this would be the place to test for other types of managers that can update the MVP Pass setting
|
| 266 |
# $F->{mvp_pass} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"mvp_pass", value=>1, readonly=>[], disabled=>[], checked=>[] }), $h->span ({ class=>"slider round" })]);
|
220 |
if ($F->{MVPid}) {
|
| 267 |
# } else {
|
221 |
$F->{MVPid} .= "->link to change...<-";
|
| 268 |
# $F->{mvp_pass} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"mvp_pass", value=>0, readonly=>[], disabled=>[] }), $h->span ({ class=>"slider round" })]);
|
222 |
}
|
| 269 |
# }
|
223 |
} else {
|
| 270 |
}
|
224 |
}
|
| 271 |
if ($AL == 5) {
|
225 |
if ($AL == RollerCon::SYSADMIN) {
|
| 272 |
$F->{email} = $h->input ({ type=>"text", name=>"email", value=>$F->{email} });
|
226 |
$F->{email} = $h->input ({ type=>"text", name=>"email", value=>$F->{email} });
|
| 273 |
} else {
|
- |
|
| 274 |
$F->{email} = $F->{email}.$h->input ({ type=>"hidden", name=>"email", value=>$F->{email} });
|
- |
|
| 275 |
}
|
227 |
} else {
|
| 276 |
if ($currentuser->{RCid} eq $F->{RCid} or $currentuser->{access} > 4) {
|
228 |
$F->{email} = $F->{email}.$h->input ({ type=>"hidden", name=>"email", value=>$F->{email} });
|
| Line 277... |
Line 229... |
| 277 |
$F->{password} = $h->input ({ type=>"password", name=>"password" });
|
229 |
}
|
| 278 |
$F->{derby_name} = $h->input ({ type=>"text", name=>"derby_name", value=>$F->{derby_name} });
|
- |
|
| 279 |
$F->{real_name} = $h->input ({ type=>"text", name=>"real_name", value=>$F->{real_name} });
|
230 |
if ($ORCUSER->{RCid} eq $F->{RCid} or $ORCUSER->{access} >= RollerCon::SYSADMIN) {
|
| 280 |
$F->{pronouns} = $h->input ({ type=>"text", name=>"pronouns", value=>$F->{pronouns} });
|
231 |
$F->{password} = $h->input ({ type=>"password", name=>"password" });
|
| 281 |
$F->{tshirt} = $h->select ({ name=>"tshirt" }, [map { $F->{tshirt} eq $_ ? $h->option ({ selected=>[] }, $_) : $h->option ($_) } @tshirtOptions] );
|
232 |
$F->{derby_name} = $h->input ({ type=>"text", name=>"derby_name", value=>$F->{derby_name} });
|
| 282 |
$F->{phone} = $h->input ({ type=>"text", name=>"phone", value=>$F->{phone} });
|
233 |
$F->{real_name} = $h->input ({ type=>"text", name=>"real_name", value=>$F->{real_name} });
|
| 283 |
$F->{timeformat} = $h->select ({ name=>"timeformat" }, [map { $F->{timeformat} eq $_ ? $h->option ({ selected=>[] }, $_) : $h->option ($_) } qw(24hr ampm)] );
|
234 |
$F->{pronouns} = $h->input ({ type=>"text", name=>"pronouns", value=>$F->{pronouns} });
|
| 284 |
} else {
|
235 |
$F->{tshirt} = $h->select ({ name=>"tshirt" }, [map { $F->{tshirt} eq $_ ? $h->option ({ selected=>[] }, $_) : $h->option ($_) } @tshirtOptions] );
|
| 285 |
$F->{password} = '*******';
|
236 |
$F->{phone} = $h->input ({ type=>"text", name=>"phone", value=>$F->{phone} });
|
| 286 |
}
|
237 |
$F->{timeformat} = $h->select ({ name=>"timeformat" }, [map { $F->{timeformat} eq $_ ? $h->option ({ selected=>[] }, $_) : $h->option ($_) } qw(24hr ampm)] );
|
| 287 |
# $F->{level} = "<SELECT NAME=level>".selectOptions ($F->{level}, [qw(AA A B C)])."</SELECT>";
|
238 |
} else {
|
| 288 |
# $F->{type} = "<SELECT NAME=type>".selectOptions ($F->{type}, [qw(official nso referee)])."</SELECT>";
|
239 |
$F->{password} = '*******';
|
| 289 |
$F->{RCid} = $h->input ({ type=>"hidden", name=>"RCid", value=>$F->{RCid} })."$F->{RCid} ";
|
240 |
}
|
| 290 |
$F->{buttons} = join " ", $h->input ({ type=>"submit", name=>"submit", value=>"Save" }), $h->input ({ type=>"reset", value=>"Reset" }), $h->input ({ type=>"submit", name=>"submit", value=>"Cancel" });
|
241 |
$F->{RCid} = $h->input ({ type=>"hidden", name=>"RCid", value=>$F->{RCid} })."$F->{RCid} ";
|
| 291 |
|
242 |
$F->{buttons} = join " ", $h->input ({ type=>"submit", name=>"submit", value=>"Save" }), $h->input ({ type=>"reset", value=>"Reset" }), $h->input ({ type=>"submit", name=>"submit", value=>"Cancel" });
|
| Line 311... |
Line 262... |
| 311 |
} else {
|
262 |
} else {
|
| 312 |
$ERRMSG = "Attempting to update someone else's record, and you don't have permission to do that.";
|
263 |
$ERRMSG = "Attempting to update someone else's record, and you don't have permission to do that.";
|
| 313 |
}
|
264 |
}
|
| Line 314... |
Line 265... |
| 314 |
|
265 |
|
| 315 |
} elsif ($view eq 'New User') {
|
266 |
} elsif ($view eq 'New User') {
|
| 316 |
$errors .= $h->br."NOTE: You will not be able to sign-up for things until your account has been reviewed and approved. Watch your email for notification.";
|
267 |
$errors .= $h->br."NOTE: You will not be able to login until your account has been activated. Watch your email for further instructions.";
|
| 317 |
# Skip authentication
|
268 |
# Skip authentication
|
| 318 |
$F->{email} = $h->input ({ type=>"text", name=>"email", value=>$F->{email} });
|
269 |
$F->{email} = $h->input ({ type=>"text", name=>"email", value=>$F->{email} });
|
| 319 |
$F->{password} = $h->input ({ type=>"password", name=>"password" });
|
270 |
$F->{password} = $h->input ({ type=>"password", name=>"password" });
|
| 320 |
$F->{derby_name} = $h->input ({ type=>"text", name=>"derby_name", value=>$F->{derby_name} });
|
271 |
$F->{derby_name} = $h->input ({ type=>"text", name=>"derby_name", value=>$F->{derby_name} });
|
| 321 |
$F->{real_name} = $h->input ({ type=>"text", name=>"real_name", value=>$F->{real_name} });
|
272 |
$F->{real_name} = $h->input ({ type=>"text", name=>"real_name", value=>$F->{real_name} });
|
| 322 |
$F->{pronouns} = $h->input ({ type=>"text", name=>"pronouns", value=>$F->{pronouns} });
|
273 |
$F->{pronouns} = $h->input ({ type=>"text", name=>"pronouns", value=>$F->{pronouns} });
|
| 323 |
$F->{tshirt} = $h->select ({ name=>"tshirt" }, [map { $F->{tshirt} eq $_ ? $h->option ({ selected=>[] }, $_) : $h->option ($_) } @tshirtOptions] );
|
274 |
$F->{tshirt} = $h->select ({ name=>"tshirt" }, [map { $F->{tshirt} eq $_ ? $h->option ({ selected=>[] }, $_) : $h->option ($_) } @tshirtOptions] );
|
| 324 |
$F->{phone} = $h->input ({ type=>"text", name=>"phone", value=>$F->{phone} });
|
275 |
$F->{phone} = $h->input ({ type=>"text", name=>"phone", value=>$F->{phone} });
|
| 325 |
$F->{timeformat} = $h->select ({ name=>"timeformat" }, [map { $F->{timeformat} eq $_ ? $h->option ({ selected=>[] }, $_) : $h->option ($_) } qw(24hr ampm)] );
|
- |
|
| 326 |
# $F->{level} = "<SELECT NAME=level>".selectOptions ($F->{level}, ["", qw(AA A B C)])."</SELECT>";
|
- |
|
| 327 |
# $F->{type} = "<SELECT NAME=type>".selectOptions ($F->{type}, ["", qw(official nso referee)])."</SELECT>";
|
276 |
$F->{timeformat} = $h->select ({ name=>"timeformat" }, [map { $F->{timeformat} eq $_ ? $h->option ({ selected=>[] }, $_) : $h->option ($_) } qw(24hr ampm)] );
|
| 328 |
$F->{RCid} = $h->input ({ type=>"hidden", name=>"RCid", value=>"New" })."TBD ";
|
277 |
$F->{RCid} = $h->input ({ type=>"hidden", name=>"RCid", value=>"New" })."TBD ";
|
| 329 |
$F->{access} = $h->input ({ type=>"hidden", name=>"access", value=>0 })."0";
|
- |
|
| Line 330... |
Line 278... |
| 330 |
# $F->{mvp_pass} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"mvp_pass", value=>0, readonly=>[], disabled=>[] }), $h->span ({ class=>"slider round" })]);
|
278 |
$F->{access} = $h->input ({ type=>"hidden", name=>"access", value=>0 })."0";
|
| 331 |
|
279 |
|
| 332 |
$F->{department} = convertDepartments ($F->{department});
|
280 |
$F->{department} = convertDepartments ($F->{department});
|
| 333 |
foreach (sort keys %{$depts}) {
|
281 |
foreach (sort keys %{$depts}) {
|
| Line 348... |
Line 296... |
| 348 |
if (!$view) {
|
296 |
if (!$view) {
|
| 349 |
$F->{'RCid'} = getUser ($EM)->{'RCid'};
|
297 |
$F->{'RCid'} = getUser ($EM)->{'RCid'};
|
| 350 |
}
|
298 |
}
|
| Line 351... |
Line 299... |
| 351 |
|
299 |
|
| 352 |
# Check to make sure they're only looking up their own ID unless they're a lead or higher
|
- |
|
| 353 |
my $currentuser = getUser ($EM);
|
300 |
# Check to make sure they're only looking up their own ID unless they're a lead or higher
|
| Line 354... |
Line 301... |
| 354 |
my $targetuser = getUser ($RCID);
|
301 |
my $targetuser = getUser ($RCID);
|
| 355 |
|
302 |
|
| 356 |
if (canView ($currentuser, $targetuser)) {
|
303 |
if (canView ($ORCUSER, $targetuser)) {
|
| 357 |
$F = $targetuser;
|
304 |
$F = $targetuser;
|
| 358 |
$F->{department} = convertDepartments ($F->{department});
|
305 |
$F->{department} = convertDepartments ($F->{department});
|
| 359 |
$F->{access} = $AccessLevel->{$F->{access}};
|
306 |
$F->{access} = $AccessLevel->{$F->{access}};
|
| Line 360... |
Line 307... |
| 360 |
$F->{'password'} = "*******";
|
307 |
$F->{'password'} = "*******";
|
| 361 |
$F->{buttons} = $h->input ({ type=>"hidden", name=>"RCid", value=>$F->{'RCid'} }).$h->input ({ type=>"submit", name=>"submit", value=>"Edit" });
|
308 |
$F->{buttons} = $h->input ({ type=>"hidden", name=>"RCid", value=>$F->{'RCid'} }).$h->input ({ type=>"submit", name=>"submit", value=>"Edit" });
|
| 362 |
|
309 |
|
| 363 |
if ($currentuser->{access} > 2 or ($currentuser->{department} and convertDepartments($currentuser->{department})->{MVP} >= 2)) {
|
310 |
if ($ORCUSER->{access} > 2 or ($ORCUSER->{department} and $ORCUSER->{department}->{MVP} >= 2)) {
|
| 364 |
if($F->{MVPid}) {
|
311 |
if($F->{MVPid}) {
|
| 365 |
$F->{MVPid} .= ' ' . $h->button ({ onClick=>"window.open('update_mvp_ticket.pl?change=Delete&RCid=$F->{RCid}&MVPid=$F->{MVPid}','Change MVP Ticket','resizable,height=260,width=370'); return false;" }, "Delete Match");
|
312 |
$F->{MVPid} .= ' ' . $h->button ({ onClick=>"window.open('update_mvp_ticket.pl?change=Delete&RCid=$F->{RCid}&MVPid=$F->{MVPid}','Change MVP Ticket','resizable,height=260,width=370'); return false;" }, "Delete Match");
|
| Line 375... |
Line 322... |
| 375 |
$F->{MVPid} .= $h->div ({ class => "hint" }, ["Possible Match: @$match", ' ', $h->button ({ onClick=>"window.open('update_mvp_ticket.pl?change=add&RCid=$F->{RCid}&MVPid=$MVPid','Change MVP Ticket','resizable,height=260,width=370'); return false;" }, "Accept Match")]);
|
322 |
$F->{MVPid} .= $h->div ({ class => "hint" }, ["Possible Match: @$match", ' ', $h->button ({ onClick=>"window.open('update_mvp_ticket.pl?change=add&RCid=$F->{RCid}&MVPid=$MVPid','Change MVP Ticket','resizable,height=260,width=370'); return false;" }, "Accept Match")]);
|
| 376 |
}
|
323 |
}
|
| 377 |
}
|
324 |
}
|
| 378 |
}
|
325 |
}
|
| 379 |
} else {
|
326 |
} else {
|
| 380 |
logit ($currentuser->{RCid}, "SECURITY: $currentuser->{derby_name} attempted to view another user's ($RCID) info");
|
327 |
logit ($ORCUSER->{RCid}, "SECURITY: $ORCUSER->{derby_name} attempted to view another user's ($RCID) info");
|
| 381 |
$errors = "Unauthorized attempt to view another user. This has been logged.";
|
328 |
$errors = "Unauthorized attempt to view another user. This has been logged.";
|
| - |
|
329 |
$RCID = "";
|
| 382 |
$F->{email} = " ";
|
330 |
$F->{email} = " ";
|
| 383 |
$F->{password} = " ";
|
331 |
$F->{password} = " ";
|
| 384 |
$F->{derby_name} = " ";
|
332 |
$F->{derby_name} = " ";
|
| 385 |
$F->{real_name} = " ";
|
333 |
$F->{real_name} = " ";
|
| 386 |
$F->{pronouns} = " ";
|
334 |
$F->{pronouns} = " ";
|
| 387 |
$F->{tshirt} = " ";
|
335 |
$F->{tshirt} = " ";
|
| 388 |
$F->{phone} = " ";
|
336 |
$F->{phone} = " ";
|
| 389 |
$F->{timeformat} = " ";
|
337 |
$F->{timeformat} = " ";
|
| 390 |
# $F->{level} = " ";
|
- |
|
| 391 |
# $F->{type} = " ";
|
- |
|
| 392 |
$F->{RCid} = " ";
|
338 |
$F->{RCid} = " ";
|
| 393 |
$F->{access} = " ";
|
339 |
$F->{access} = " ";
|
| 394 |
$F->{MVPid} = " ";
|
340 |
$F->{MVPid} = " ";
|
| 395 |
$F->{buttons} = " ";
|
341 |
$F->{buttons} = " ";
|
| 396 |
}
|
342 |
}
|
| Line 397... |
Line -... |
| 397 |
|
- |
|
| 398 |
# if (lc $EM eq lc $F->{email} or $AL > 1) {
|
- |
|
| 399 |
# $F->{buttons} = $h->input ({ type=>"hidden", name=>"RCid", value=>$F->{'RCid'} }).$h->input ({ type=>"submit", name=>"submit", value=>"Edit" });
|
- |
|
| 400 |
# } else {
|
- |
|
| 401 |
# $F->{buttons} = "";
|
- |
|
| 402 |
# }
|
- |
|
| 403 |
} #else {
|
- |
|
| 404 |
# $cookie_string = authenticate(1);
|
- |
|
| 405 |
# $FORM->{email} = " ";
|
- |
|
| 406 |
# $FORM->{password} = " ";
|
- |
|
| 407 |
# $FORM->{derby_name} = " ";
|
- |
|
| 408 |
# $FORM->{real_name} = " ";
|
- |
|
| 409 |
# $FORM->{phone} = " ";
|
- |
|
| 410 |
# $FORM->{level} = " ";
|
- |
|
| 411 |
# $FORM->{type} = " ";
|
- |
|
| 412 |
# $FORM->{RCid} = " ";
|
- |
|
| 413 |
# $FORM->{access} = " ";
|
- |
|
| 414 |
# $FORM->{mvp_pass} = " ";
|
- |
|
| 415 |
# $FORM->{buttons} = " ";
|
343 |
|
| Line 416... |
Line 344... |
| 416 |
#}
|
344 |
}
|
| Line 417... |
Line 345... |
| 417 |
|
345 |
|
| Line 418... |
Line 346... |
| 418 |
#---------------START THE HTML--------------------
|
346 |
#---------------START THE HTML--------------------
|
| Line 419... |
Line 347... |
| 419 |
|
347 |
|
| 420 |
my $RCAUTH_cookie = cookie (-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
|
348 |
my $RCAUTH_cookie = cookie (-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
|
| 421 |
|
349 |
|
| Line 422... |
Line 350... |
| 422 |
print header (-cookie=>$RCAUTH_cookie);
|
350 |
print header (-cookie=>$RCAUTH_cookie);
|
| 423 |
|
351 |
|
| 424 |
#foreach (keys %ENV) {
|
352 |
#foreach (keys %ENV) {
|
| 425 |
# print "$_: $ENV{$_}\n<br>";
|
353 |
# warn "$_: $ENV{$_}\n<br>";
|
| 426 |
#}
|
354 |
#}
|
| Line 427... |
Line 355... |
| 427 |
|
355 |
|
| 428 |
if ($errors) {
|
- |
|
| 429 |
$errors = $h->div ({ class=>"error" }, $errors);
|
356 |
if ($errors) {
|
| 430 |
} else {
|
- |
|
| 431 |
$errors = "";
|
357 |
$errors = $h->div ({ class=>"error" }, $errors);
|
| 432 |
}
|
358 |
} else {
|
| 433 |
|
359 |
$errors = "";
|
| 434 |
my @printDepartments = ( $h->div ({ class=>"index", style=>"display: unset;" }, $h->p ({ class=>"heading" }, "Volunteer Department Access:")) );
|
360 |
}
|
| 435 |
# push @printDepartments, $h->div ({ class=>"rTableRow" }, $h->div ({ class=>"rTableCellr hint", style=>"display:block;" }, "Here is where you're signed up to volunteer at RollerCon:"));
|
361 |
|
| Line 466... |
Line 392... |
| 466 |
@printDepartments,
|
392 |
@printDepartments,
|
| 467 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCell" }, " ") ]),
|
393 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCell" }, " ") ]),
|
| 468 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr" }, $h->a ({ href=>$goback }, "[go back]"), $F->{buttons}) ])
|
394 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr" }, $h->a ({ href=>$goback }, "[go back]"), $F->{buttons}) ])
|
| 469 |
])
|
395 |
])
|
| 470 |
])
|
396 |
])
|
| 471 |
]); # print $h->close('form');
|
397 |
]);
|
| 472 |
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Schedule:"), getSchedule ($RCID, "all")]) unless $RCID !~ /^\d+$/;
|
398 |
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Schedule:"), getSchedule ($RCID, "all")]) unless $RCID !~ /^\d+$/;
|
| 473 |
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Recent Activity:"), getLog ($RCID)]) unless $RCID !~ /^\d+$/;
|
399 |
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Recent Activity:"), getLog ($RCID)]) unless $RCID !~ /^\d+$/;
|
| 474 |
print $h->close ('html');
|
400 |
print $h->close ('html');
|
| - |
|
401 |
exit;
|
| 475 |
}
|
402 |
}
|
| Line 476... |
Line -... |
| 476 |
|
- |
|
| 477 |
#sub selectOptions {
|
- |
|
| 478 |
# my $selectedOption = shift;
|
- |
|
| 479 |
# my $options = shift;
|
- |
|
| 480 |
# return join " ", map { $selectedOption eq $_ ?
|
- |
|
| 481 |
# $h->option ({ value=>$_, selected=>[] }, $_) :
|
- |
|
| 482 |
# $h->option ({ value=>$_ }, $_)
|
- |
|
| 483 |
# } @$options;
|
- |
|
| 484 |
#}
|
- |
|
| Line 485... |
Line 403... |
| 485 |
|
403 |
|
| 486 |
|
404 |
|
| 487 |
sub checkDupes {
|
405 |
sub checkDupes {
|
| 488 |
my $field = shift;
|
406 |
my $field = shift;
|
| Line 523... |
Line 441... |
| 523 |
while (my ($tla, $name) = $sth->fetchrow) {
|
441 |
while (my ($tla, $name) = $sth->fetchrow) {
|
| 524 |
$HASH{$tla} = $name;
|
442 |
$HASH{$tla} = $name;
|
| 525 |
}
|
443 |
}
|
| 526 |
return \%HASH;
|
444 |
return \%HASH;
|
| 527 |
}
|
445 |
}
|
| - |
|
446 |
|
| - |
|
447 |
sub changeUser {
|
| - |
|
448 |
my ($uid, $field, $newvalue) = @_;
|
| - |
|
449 |
|
| - |
|
450 |
return "ERROR: Bad (or missing) RCid: [$uid]" unless $uid =~ /^\d+$/;
|
| - |
|
451 |
return "ERROR: Bad (or missing) field name: [$field]" unless $field;
|
| - |
|
452 |
# return "ERROR: Bad (or missing) new value: [$newvalue]" unless $newvalue;
|
| - |
|
453 |
return "ERROR: Can't change someone's RCid" if $field eq "RCid";
|
| - |
|
454 |
|
| - |
|
455 |
if ($field eq "password") {
|
| - |
|
456 |
return unless $newvalue;
|
| - |
|
457 |
$dbh->do ("update official set password = password(?) where RCid = ?", undef, $newvalue, $uid) or return "ERROR: ".$dbh->errstr;
|
| - |
|
458 |
} else {
|
| - |
|
459 |
$dbh->do ("update official set $field = ? where RCid = ?", undef, $newvalue, $uid) or return "ERROR: ".$dbh->errstr;
|
| - |
|
460 |
}
|
| - |
|
461 |
|
| - |
|
462 |
$newvalue = '********' if $field eq "password";
|
| - |
|
463 |
if ($ORCUSER->{RCid} eq $uid) {
|
| - |
|
464 |
logit ($uid, "Updated Profile: $field -> $newvalue");
|
| - |
|
465 |
} else {
|
| - |
|
466 |
logit ($ORCUSER->{RCid}, "Updated User [$uid]: $field -> $newvalue");
|
| - |
|
467 |
logit ($uid, "$ORCUSER->{derby_name} updated your profile: $field -> $newvalue");
|
| - |
|
468 |
}
|
| - |
|
469 |
|
| - |
|
470 |
return;
|
| - |
|
471 |
}
|
| 528 |
|
472 |
|