Collect WHOIS name on account page

This commit is contained in:
Al Beano 2017-10-04 09:02:11 +01:00
parent 0e7e3c1653
commit 8e672a7a73
4 changed files with 25 additions and 2 deletions

2
dbupdate/9.sql Normal file
View File

@ -0,0 +1,2 @@
alter table user add column whois_name text;
update cyberman set dbrev=10;

View File

@ -74,6 +74,10 @@ post '/account' => sub {
$errs{"e_bad_privacy"} = 1; $errs{"e_bad_privacy"} = 1;
} }
if (param("whois_name") !~ m/^[A-Za-z0-9 \'-]{0,64}$/) {
$errs{"e_bad_name"} = 1;
}
if (scalar(keys %errs) != 0) { if (scalar(keys %errs) != 0) {
return template 'account' => { return template 'account' => {
"user" => $user, "user" => $user,
@ -138,6 +142,7 @@ post '/account' => sub {
{ {
"stylesheet" => param("stylesheet"), "stylesheet" => param("stylesheet"),
"email_pub" => param("email_pub"), "email_pub" => param("email_pub"),
"whois_name" => param("whois_name"),
}, },
); );

View File

@ -6,7 +6,7 @@ create table cyberman (
lastserial integer not null default 0, lastserial integer not null default 0,
zonecheckstatus integer not null default 0, zonecheckstatus integer not null default 0,
); );
insert into cyberman (dbrev) values (9); insert into cyberman (dbrev) values (10);
drop table if exists user; drop table if exists user;
create table user ( create table user (
@ -20,7 +20,8 @@ create table user (
recoverytoken text, recoverytoken text,
stylesheet text, stylesheet text,
admin integer not null default 0, admin integer not null default 0,
email_pub integer not null default 0 email_pub integer not null default 0,
whois_name text
); );
drop table if exists session; drop table if exists session;

View File

@ -37,6 +37,9 @@
<% IF e_bad_privacy %> <% IF e_bad_privacy %>
<li>Please select a value for WHOIS privacy.</li> <li>Please select a value for WHOIS privacy.</li>
<% END %> <% END %>
<% IF e_bad_name %>
<li>The name you entered is invalid, sorry. Please use Latin characters only.</li>
<% END %>
</ul> </ul>
</div> </div>
</div> </div>
@ -94,6 +97,18 @@
</select> </select>
</td> </td>
</tr> </tr>
<tr>
<td>
<label for="whois_name">Name to dislplay in WHOIS:</label>
</td>
<td>
<input type="text" name="whois_name" id="whois_name" placeholder="Leave blank to withhold"
<% IF user.whois_name %>
value="<% user.whois_name | html_entity %>"
<% END %>
/>
</td>
</tr>
<tr> <tr>
<td> <td>
<label for="email_pub">Show email address in WHOIS:</label> <label for="email_pub">Show email address in WHOIS:</label>