Implement domain removal
This commit is contained in:
parent
7d883ebd63
commit
9590e6bb78
|
@ -72,4 +72,46 @@ post '/domains/new' => sub {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
get '/domains/:id/remove' => sub {
|
||||||
|
my $domain = database->quick_select(
|
||||||
|
"domain",
|
||||||
|
{
|
||||||
|
"id" => param("id"),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
return auth_test($domain->{"ownerid"}) if auth_test($domain->{"ownerid"});
|
||||||
|
|
||||||
|
template 'domains/remove.tt' => {
|
||||||
|
"domain" => $domain,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
post '/domains/:id/remove' => sub {
|
||||||
|
my $domain = database->quick_select(
|
||||||
|
"domain",
|
||||||
|
{
|
||||||
|
"id" => param("id"),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!$domain) {
|
||||||
|
# quick and dirty error that shouldn't really appear
|
||||||
|
return "No such domain!";
|
||||||
|
}
|
||||||
|
|
||||||
|
return auth_test($domain->{"ownerid"}) if auth_test($domain->{"ownerid"});
|
||||||
|
|
||||||
|
database->quick_delete(
|
||||||
|
"domain",
|
||||||
|
{
|
||||||
|
"id" => param("id"),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
template redir => {
|
||||||
|
redir => "../../domains?removed=$domain->{name}",
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
true;
|
true;
|
||||||
|
|
|
@ -6,10 +6,19 @@ use Exporter qw(import);
|
||||||
our @EXPORT = qw(auth_test);
|
our @EXPORT = qw(auth_test);
|
||||||
|
|
||||||
sub auth_test {
|
sub auth_test {
|
||||||
|
my $id = undef;
|
||||||
|
if (@_) {
|
||||||
|
$id = shift;
|
||||||
|
}
|
||||||
|
|
||||||
if (!vars->{"auth"}) {
|
if (!vars->{"auth"}) {
|
||||||
return template 'redir' => {
|
return template 'redir' => {
|
||||||
"redir" => "/index",
|
"redir" => "/index",
|
||||||
};
|
};
|
||||||
|
} elsif ($id && vars->{"auth"} != $id) {
|
||||||
|
return template 'redir' => {
|
||||||
|
"redir" => "/index",
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
return 0; # nothing to be returned, route can continue
|
return 0; # nothing to be returned, route can continue
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,12 @@
|
||||||
</div>
|
</div>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<% END %>
|
<% END %>
|
||||||
|
<% IF params.removed %>
|
||||||
|
<div class="msgBox">
|
||||||
|
The domain '<% params.removed | html_entity %>.cyb' was removed successfully.
|
||||||
|
</div>
|
||||||
|
<br /><br />
|
||||||
|
<% END %>
|
||||||
</center>
|
</center>
|
||||||
|
|
||||||
<div class="body">
|
<div class="body">
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<% IF domain %>
|
||||||
|
<center>
|
||||||
|
<br />
|
||||||
|
<h1>Removal of <% domain.name %>.cyb</h1>
|
||||||
|
<br />
|
||||||
|
</center>
|
||||||
|
|
||||||
|
<div class="body">
|
||||||
|
<p>
|
||||||
|
You are about to permanently remove <% domain.name %>.cyb and all its records.
|
||||||
|
</p>
|
||||||
|
<p style="font-size:1.6em">
|
||||||
|
YOU ARE ABOUT TO PERMANENTLY REMOVE <% domain.name %>.cyb AND ALL ITS RECORDS!
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
There is <strong>no</strong> guarantee that you will be able to re-register this domain at a later date.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<center>
|
||||||
|
<form method="POST">
|
||||||
|
[ <button class="textButton" action="submit">yes, destroy the domain</button> ]
|
||||||
|
</form>
|
||||||
|
</center>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<% ELSE %>
|
||||||
|
<center>
|
||||||
|
No such domain!
|
||||||
|
<br />
|
||||||
|
[ <a href="../../domains" class="bracketButton">go back</a> ]
|
||||||
|
</center>
|
||||||
|
<% END %>
|
Loading…
Reference in New Issue