From f97a931d13f04a8d3467c18c152db2c2527205d1 Mon Sep 17 00:00:00 2001 From: Al Beano Date: Sat, 19 Aug 2017 23:45:25 +0100 Subject: [PATCH] Indentation cleanup (switch to tabs) --- app.psgi | 8 +- bin/writezone.pl | 34 ++--- cpanfile | 4 +- dbupdate/1.sql | 4 +- lib/cyberman.pm | 84 ++++++------ lib/cyberman/API.pm | 38 +++--- lib/cyberman/Account.pm | 252 ++++++++++++++++++------------------ lib/cyberman/Auth.pm | 230 ++++++++++++++++----------------- lib/cyberman/Domains.pm | 170 ++++++++++++------------- lib/cyberman/Forgot.pm | 182 +++++++++++++------------- lib/cyberman/Helper.pm | 106 ++++++++-------- lib/cyberman/Records.pm | 260 +++++++++++++++++++------------------- public/css/style.css | 52 ++++---- public/js/domain_check.js | 30 ++--- schema.sql | 48 +++---- views/account.tt | 136 ++++++++++---------- views/charter.tt | 10 +- views/confirm_forgot.tt | 88 ++++++------- views/confirmed.tt | 8 +- views/domains.tt | 106 ++++++++-------- views/domains/new.tt | 54 ++++---- views/domains/remove.tt | 44 +++---- views/forgot.tt | 44 +++---- views/index.tt | 16 +-- views/layouts/main.tt | 56 ++++---- views/login.tt | 110 ++++++++-------- views/records/add.tt | 126 +++++++++--------- views/redir.tt | 2 +- views/register.tt | 120 +++++++++--------- 29 files changed, 1211 insertions(+), 1211 deletions(-) diff --git a/app.psgi b/app.psgi index ac0e381..3af6743 100755 --- a/app.psgi +++ b/app.psgi @@ -9,8 +9,8 @@ use cyberman; use Plack::Builder; builder { - enable "Deflater"; - enable "Session"; - enable "CSRFBlock"; - cyberman->to_app; + enable "Deflater"; + enable "Session"; + enable "CSRFBlock"; + cyberman->to_app; } diff --git a/bin/writezone.pl b/bin/writezone.pl index 55673fd..66ed4ad 100755 --- a/bin/writezone.pl +++ b/bin/writezone.pl @@ -37,12 +37,12 @@ say $out <<'END'; END if ($conf->{"include"}->{"enabled"}) { - say $out "\$INCLUDE $conf->{include}->{file}"; + say $out "\$INCLUDE $conf->{include}->{file}"; } # Time to get the records die "Unsupported database!" - unless $yml->[0]->{"plugins"}->{"Database"}->{"driver"} eq "SQLite"; + unless $yml->[0]->{"plugins"}->{"Database"}->{"driver"} eq "SQLite"; my $dbfile = "$Bin/../$yml->[0]->{plugins}->{Database}->{dbname}"; my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile", "", ""); @@ -50,24 +50,24 @@ my $sth = $dbh->prepare("SELECT * FROM record"); $sth->execute; while (my $r = $sth->fetchrow_hashref) { - # Look up domain - my $dsth = $dbh->prepare("select * from domain where id=?"); - $dsth->bind_param(1, $r->{"domainid"}); - $dsth->execute; - my $d = $dsth->fetchrow_hashref; + # Look up domain + my $dsth = $dbh->prepare("select * from domain where id=?"); + $dsth->bind_param(1, $r->{"domainid"}); + $dsth->execute; + my $d = $dsth->fetchrow_hashref; - # domain name - if ($r->{"name"} eq '@') { - print $out $d->{"name"}, " "; - } else { - print $out $r->{"name"}, ".", $d->{"name"}, " "; - } + # domain name + if ($r->{"name"} eq '@') { + print $out $d->{"name"}, " "; + } else { + print $out $r->{"name"}, ".", $d->{"name"}, " "; + } - # record type - print $out "IN $r->{type} "; + # record type + print $out "IN $r->{type} "; - # value - say $out $r->{value}; + # value + say $out $r->{value}; } close $out; diff --git a/cpanfile b/cpanfile index c61365f..9c8a9bc 100644 --- a/cpanfile +++ b/cpanfile @@ -21,6 +21,6 @@ requires "Plack::Middleware::Session" => "0"; requires "Plack::Middleware::CSRFBlock" => "0"; on "test" => sub { - requires "Test::More" => "0"; - requires "HTTP::Request::Common" => "0"; + requires "Test::More" => "0"; + requires "HTTP::Request::Common" => "0"; }; diff --git a/dbupdate/1.sql b/dbupdate/1.sql index e77c649..1a32744 100644 --- a/dbupdate/1.sql +++ b/dbupdate/1.sql @@ -1,6 +1,6 @@ create table cyberman ( - id integer primary key, - dbrev integer not null + id integer primary key, + dbrev integer not null ); insert into cyberman (dbrev) values (2); diff --git a/lib/cyberman.pm b/lib/cyberman.pm index 8949b7d..9671362 100644 --- a/lib/cyberman.pm +++ b/lib/cyberman.pm @@ -14,57 +14,57 @@ use cyberman::Forgot; # Index route, hook and helper functions for authentication sub get_auth { - my $uid = shift; - my $token = shift; + my $uid = shift; + my $token = shift; - my $result = database->quick_select("session", {"uid" => $uid, "token" => $token}); - - if ($result) { - return $uid; - } else { - return 0; - } + my $result = database->quick_select("session", {"uid" => $uid, "token" => $token}); + + if ($result) { + return $uid; + } else { + return 0; + } } hook 'before' => sub { - sub cookieval { - my $name = shift; - my $cookie = cookie($name); - if ($cookie) { - return $cookie->value; - } else { - return undef; - } - } - - my $uid = cookieval("id"); - my $token = cookieval("token"); - my $auth = 0; - my $email; - if ($uid && $token) { - $auth = get_auth($uid, $token); - $email = database->quick_lookup( - "user", - { - "id" => $uid, - }, - "email", - ); - } + sub cookieval { + my $name = shift; + my $cookie = cookie($name); + if ($cookie) { + return $cookie->value; + } else { + return undef; + } + } - var auth => $auth; - var email => $email; - var config => config(); + my $uid = cookieval("id"); + my $token = cookieval("token"); + my $auth = 0; + my $email; + if ($uid && $token) { + $auth = get_auth($uid, $token); + $email = database->quick_lookup( + "user", + { + "id" => $uid, + }, + "email", + ); + } + + var auth => $auth; + var email => $email; + var config => config(); }; get qr{^/(index)?$} => sub { - if (!vars->{auth}) { - return template 'index'; - } + if (!vars->{auth}) { + return template 'index'; + } - template 'redir' => { - "redir" => "domains", - }; + template 'redir' => { + "redir" => "domains", + }; }; true; diff --git a/lib/cyberman/API.pm b/lib/cyberman/API.pm index 5d42a3b..a211280 100644 --- a/lib/cyberman/API.pm +++ b/lib/cyberman/API.pm @@ -5,29 +5,29 @@ use Dancer2::Plugin::Database; use cyberman::Helper; get '/api/check_availability' => sub { - # No auth req'd - # returns 'y' or 'n' + # No auth req'd + # returns 'y' or 'n' - if (!param("name")) { - return "n"; - } + if (!param("name")) { + return "n"; + } - if (!check_name(param "name")) { - return "n"; - } + if (!check_name(param "name")) { + return "n"; + } - my $result = database->quick_select( - "domain", - { - "name" => param("name"), - } - ); + my $result = database->quick_select( + "domain", + { + "name" => param("name"), + } + ); - if ($result) { - return "n"; - } else { - return "y"; - } + if ($result) { + return "n"; + } else { + return "y"; + } }; true; diff --git a/lib/cyberman/Account.pm b/lib/cyberman/Account.pm index fd602cb..294966c 100644 --- a/lib/cyberman/Account.pm +++ b/lib/cyberman/Account.pm @@ -6,159 +6,159 @@ use URI::Escape; use cyberman::Helper; get '/account' => sub { - return auth_test() if auth_test(); + return auth_test() if auth_test(); - my $user = database->quick_select( - "user", - { - "id" => vars->{"auth"}, - }, - ); + my $user = database->quick_select( + "user", + { + "id" => vars->{"auth"}, + }, + ); - template 'account' => { - "user" => $user, - }; + template 'account' => { + "user" => $user, + }; }; post '/account' => sub { - return auth_test() if auth_test(); + return auth_test() if auth_test(); - my %errs; - my $new_pass = 0; + my %errs; + my $new_pass = 0; - my $user = database->quick_select ( - "user", - { - "id" => vars->{"auth"}, - } - ); + my $user = database->quick_select ( + "user", + { + "id" => vars->{"auth"}, + } + ); - if (!param("email")) { - $errs{"e_no_email"} = 1; - } + if (!param("email")) { + $errs{"e_no_email"} = 1; + } - if (param("email") ne $user->{"email"}) { - my $result = database->quick_select ( - "user", - { - "email" => param("email"), - }, - ); - - if ($result) { - $errs{"e_email_exists"} = 1; - } - } + if (param("email") ne $user->{"email"}) { + my $result = database->quick_select ( + "user", + { + "email" => param("email"), + }, + ); - if (param("password") || param("npassword") || param("npassword2")) { - $new_pass = 1; + if ($result) { + $errs{"e_email_exists"} = 1; + } + } - my ($o_hash, $o_salt) = hash_password(param("password"), $user->{"salt"}); - if ($o_hash ne $user->{"password"}) { - $errs{"e_wrong_pass"} = 1; - } + if (param("password") || param("npassword") || param("npassword2")) { + $new_pass = 1; - if (param "npassword" ne param "npassword2") { - $errs{"e_pass_mismatch"} = 1; - } elsif (length(param "npassword") < 8) { - $errs{"e_pass_len"} = 1; - } - } + my ($o_hash, $o_salt) = hash_password(param("password"), $user->{"salt"}); + if ($o_hash ne $user->{"password"}) { + $errs{"e_wrong_pass"} = 1; + } - if (scalar(keys %errs) != 0) { - return template 'account' => { - "user" => $user, - error => 1, - %errs, - }; - } + if (param "npassword" ne param "npassword2") { + $errs{"e_pass_mismatch"} = 1; + } elsif (length(param "npassword") < 8) { + $errs{"e_pass_len"} = 1; + } + } - if (param("email") ne $user->{"email"}) { - my $conftoken = randstring(16); + if (scalar(keys %errs) != 0) { + return template 'account' => { + "user" => $user, + error => 1, + %errs, + }; + } - database->quick_update ( - "user", - { - "id" => vars->{"auth"}, - }, - { - "newemail" => param("email"), - "conftoken" => $conftoken, - }, - ); + if (param("email") ne $user->{"email"}) { + my $conftoken = randstring(16); - my $email = template 'email/update' => { - "link" => config->{"mail"}->{"baseurl"} . "/confirm_update?o=" . uri_escape($user->{"email"}) . "&n=" . uri_escape(param "email") . "&t=$conftoken", - }, - { - "layout" => undef, - }; - send_email(param("email"), $email); - } + database->quick_update ( + "user", + { + "id" => vars->{"auth"}, + }, + { + "newemail" => param("email"), + "conftoken" => $conftoken, + }, + ); - if ($new_pass) { - my ($hash, $salt) = hash_password(param "npassword"); - database->quick_update ( - "user", - { - "id" => vars->{"auth"}, - }, - { - "password" => $hash, - "salt" => $salt, - }, - ); + my $email = template 'email/update' => { + "link" => config->{"mail"}->{"baseurl"} . "/confirm_update?o=" . uri_escape($user->{"email"}) . "&n=" . uri_escape(param "email") . "&t=$conftoken", + }, + { + "layout" => undef, + }; + send_email(param("email"), $email); + } - database->quick_delete ( - "session", - { - "uid" => vars->{"auth"}, - }, - ); + if ($new_pass) { + my ($hash, $salt) = hash_password(param "npassword"); + database->quick_update ( + "user", + { + "id" => vars->{"auth"}, + }, + { + "password" => $hash, + "salt" => $salt, + }, + ); - return template 'redir' => { - "redir" => "login?pwchange=1", - }; - } + database->quick_delete ( + "session", + { + "uid" => vars->{"auth"}, + }, + ); - $user = database->quick_select ( - "user", - { - "id" => vars->{"auth"}, - }, - ); + return template 'redir' => { + "redir" => "login?pwchange=1", + }; + } - template 'account' => { - updated => 1, - user => $user, - }; + $user = database->quick_select ( + "user", + { + "id" => vars->{"auth"}, + }, + ); + + template 'account' => { + updated => 1, + user => $user, + }; }; get '/confirm_update' => sub { - my $user = database->quick_select( - "user", - { - "email" => param("o"), - "newemail" => param("n"), - "conftoken" => param("t"), - }, - ); + my $user = database->quick_select( + "user", + { + "email" => param("o"), + "newemail" => param("n"), + "conftoken" => param("t"), + }, + ); - if (!$user) { - return "No such user/token!"; - } + if (!$user) { + return "No such user/token!"; + } - database->quick_update( - "user", - { - "id" => $user->{"id"}, - }, - { - "email" => param("n"), - }, - ); + database->quick_update( + "user", + { + "id" => $user->{"id"}, + }, + { + "email" => param("n"), + }, + ); - template 'confirmed'; + template 'confirmed'; }; true; diff --git a/lib/cyberman/Auth.pm b/lib/cyberman/Auth.pm index 36be74c..68341ec 100644 --- a/lib/cyberman/Auth.pm +++ b/lib/cyberman/Auth.pm @@ -10,153 +10,153 @@ use cyberman::Helper; # Hooks and helper functions for authentication are in cyberman.pm post '/register' => sub { - my %errs; + my %errs; - for my $param ("password", "password2", "email") { - if (!param($param)) { - $errs{"e_no_$param"} = 1; - } - } + for my $param ("password", "password2", "email") { + if (!param($param)) { + $errs{"e_no_$param"} = 1; + } + } - my $result = database->quick_select( - "user", - { - "email" => param("email"), - }, - ); + my $result = database->quick_select( + "user", + { + "email" => param("email"), + }, + ); - if ($result) { - $errs{"e_email_exists"} = 1; - } + if ($result) { + $errs{"e_email_exists"} = 1; + } - if (!exists $errs{"e_no_password"} || !exists $errs{"e_no_password2"}) { - if (param("password") ne param("password2")) { - $errs{"e_pass_match"} = 1; - } + if (!exists $errs{"e_no_password"} || !exists $errs{"e_no_password2"}) { + if (param("password") ne param("password2")) { + $errs{"e_pass_match"} = 1; + } - if (length param("password") < 8) { - $errs{"e_pass_len"} = 1; - } - } + if (length param("password") < 8) { + $errs{"e_pass_len"} = 1; + } + } - if (scalar(keys(%errs)) != 0) { - return template 'register' => { - error => 1, - %errs, - }; - } + if (scalar(keys(%errs)) != 0) { + return template 'register' => { + error => 1, + %errs, + }; + } - my ($hash, $salt) = hash_password(param("password")); - my $conftoken = randstring(16); + my ($hash, $salt) = hash_password(param("password")); + my $conftoken = randstring(16); - # Create the account in the database - database->quick_insert( - "user", - { - "email" => param("email"), - "password" => $hash, - "salt" => $salt, - "conftoken" => $conftoken, - }, - ); + # Create the account in the database + database->quick_insert( + "user", + { + "email" => param("email"), + "password" => $hash, + "salt" => $salt, + "conftoken" => $conftoken, + }, + ); - # Send email - my $email = template 'email/registration' => { - "link" => config->{"mail"}->{"baseurl"} . "/confirm_new?e=" . uri_escape(param "email") . "&t=$conftoken", - }, - { - "layout" => undef, - }; - send_email(param("email"), $email); + # Send email + my $email = template 'email/registration' => { + "link" => config->{"mail"}->{"baseurl"} . "/confirm_new?e=" . uri_escape(param "email") . "&t=$conftoken", + }, + { + "layout" => undef, + }; + send_email(param("email"), $email); - template 'login' => { - account_created => 1, - }; + template 'login' => { + account_created => 1, + }; }; post '/login' => sub { - my %errs; + my %errs; - my $user = database->quick_select( - "user", - { - "email" => param("email"), - }, - ); + my $user = database->quick_select( + "user", + { + "email" => param("email"), + }, + ); - if (!$user) { - $errs{"e_no_user"} = 1; - } + if (!$user) { + $errs{"e_no_user"} = 1; + } - if (scalar(keys(%errs)) == 0) { - my ($hash, $salt) = hash_password(param("password"), $user->{"salt"}); - $errs{"e_pass"} = 1 unless $hash eq $user->{"password"}; - } + if (scalar(keys(%errs)) == 0) { + my ($hash, $salt) = hash_password(param("password"), $user->{"salt"}); + $errs{"e_pass"} = 1 unless $hash eq $user->{"password"}; + } - if (scalar(keys(%errs)) == 0) { - $errs{"e_not_confirmed"} = 1 unless $user->{"active"}; - } + if (scalar(keys(%errs)) == 0) { + $errs{"e_not_confirmed"} = 1 unless $user->{"active"}; + } - if (scalar(keys(%errs)) != 0) { - return template 'login' => { - error => 1, - %errs, - }; - } + if (scalar(keys(%errs)) != 0) { + return template 'login' => { + error => 1, + %errs, + }; + } - # checks finished, we can create a session now + # checks finished, we can create a session now - my $token = randstring(32); + my $token = randstring(32); - database->quick_insert( - "session", - { - "token" => $token, - "uid" => $user->{"id"}, - "since" => time, - }, - ); + database->quick_insert( + "session", + { + "token" => $token, + "uid" => $user->{"id"}, + "since" => time, + }, + ); - cookie id => $user->{"id"}, http_only => 1; - cookie token => $token, http_only => 1; + cookie id => $user->{"id"}, http_only => 1; + cookie token => $token, http_only => 1; - template 'redir' => { - "redir" => "domains", - }; + template 'redir' => { + "redir" => "domains", + }; }; get '/confirm_new' => sub { - my $user = database->quick_select( - "user", - { - "email" => param("e"), - "conftoken" => param("t"), - }, - ); + my $user = database->quick_select( + "user", + { + "email" => param("e"), + "conftoken" => param("t"), + }, + ); - if (!$user) { - return "No such user/token!"; - } + if (!$user) { + return "No such user/token!"; + } - database->quick_update( - "user", - { - "id" => $user->{"id"}, - }, - { - "active" => 1, - }, - ); + database->quick_update( + "user", + { + "id" => $user->{"id"}, + }, + { + "active" => 1, + }, + ); - template 'confirmed'; + template 'confirmed'; }; post '/logout' => sub { - cookie 'id' => undef; - cookie 'token' => undef; - template 'redir' => { - "redir" => "index", - }; + cookie 'id' => undef; + cookie 'token' => undef; + template 'redir' => { + "redir" => "index", + }; }; true; diff --git a/lib/cyberman/Domains.pm b/lib/cyberman/Domains.pm index 0901112..4a68f80 100644 --- a/lib/cyberman/Domains.pm +++ b/lib/cyberman/Domains.pm @@ -6,118 +6,118 @@ use Dancer2::Plugin::Database; use cyberman::Helper; get '/domains' => sub { - return auth_test() if auth_test(); + return auth_test() if auth_test(); - my @domains = database->quick_select( - "domain", - { - "ownerid" => vars->{"auth"}, - }, - ); + my @domains = database->quick_select( + "domain", + { + "ownerid" => vars->{"auth"}, + }, + ); - template 'domains' => { - "domains" => \@domains, - } + template 'domains' => { + "domains" => \@domains, + } }; post '/domains/new' => sub { - return auth_test() if auth_test(); + return auth_test() if auth_test(); - my %errs; + my %errs; - if (!param("name")) { - $errs{"e_no_name"} = 1; - } + if (!param("name")) { + $errs{"e_no_name"} = 1; + } - my $name = lc param("name"); + my $name = lc param("name"); - if (scalar(keys(%errs)) == 0) { - if (!check_name(param "name")) { - $errs{"e_chars"} = 1; - } - } + if (scalar(keys(%errs)) == 0) { + if (!check_name(param "name")) { + $errs{"e_chars"} = 1; + } + } - if (scalar(keys(%errs)) == 0) { - my $result = database->quick_select( - "domain", - { - "name" => param("name"), - }, - ); + if (scalar(keys(%errs)) == 0) { + my $result = database->quick_select( + "domain", + { + "name" => param("name"), + }, + ); - if ($result) { - $errs{"e_exists"} = 1; - } - } + if ($result) { + $errs{"e_exists"} = 1; + } + } - if (scalar(keys(%errs)) == 0) { - foreach my $disallowed (@{ config->{"reserved_domains"} }) { - if ($name eq $disallowed) { - $errs{"e_reserved"} = 1; - } - } - } + if (scalar(keys(%errs)) == 0) { + foreach my $disallowed (@{ config->{"reserved_domains"} }) { + if ($name eq $disallowed) { + $errs{"e_reserved"} = 1; + } + } + } - if (scalar(keys(%errs)) != 0) { - return template 'domains/new' => { - %errs, - error => 1, - }; - } + if (scalar(keys(%errs)) != 0) { + return template 'domains/new' => { + %errs, + error => 1, + }; + } - database->quick_insert( - "domain", - { - "name" => $name, - "ownerid" => vars->{"auth"}, - }, - ); + database->quick_insert( + "domain", + { + "name" => $name, + "ownerid" => vars->{"auth"}, + }, + ); - template 'redir' => { - "redir" => "../domains?new=$name", - }; + template 'redir' => { + "redir" => "../domains?new=$name", + }; }; get '/domains/:name/remove' => sub { - my $domain = database->quick_select( - "domain", - { - "name" => param("name"), - }, - ); + my $domain = database->quick_select( + "domain", + { + "name" => param("name"), + }, + ); - return auth_test($domain->{"ownerid"}) if auth_test($domain->{"ownerid"}); + return auth_test($domain->{"ownerid"}) if auth_test($domain->{"ownerid"}); - template 'domains/remove.tt' => { - "domain" => $domain, - }; + template 'domains/remove.tt' => { + "domain" => $domain, + }; }; post '/domains/:name/remove' => sub { - my $domain = database->quick_select( - "domain", - { - "name" => param("name"), - }, - ); + my $domain = database->quick_select( + "domain", + { + "name" => param("name"), + }, + ); - if (!$domain) { - # quick and dirty error that shouldn't really appear - return "No such domain!"; - } + 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"}); + return auth_test($domain->{"ownerid"}) if auth_test($domain->{"ownerid"}); - database->quick_delete( - "domain", - { - "name" => param("name"), - }, - ); + database->quick_delete( + "domain", + { + "name" => param("name"), + }, + ); - template redir => { - redir => "../../domains?removed=$domain->{name}", - }; + template redir => { + redir => "../../domains?removed=$domain->{name}", + }; }; true; diff --git a/lib/cyberman/Forgot.pm b/lib/cyberman/Forgot.pm index b10a26c..5a1f5ef 100644 --- a/lib/cyberman/Forgot.pm +++ b/lib/cyberman/Forgot.pm @@ -7,111 +7,111 @@ use URI::Escape; use cyberman::Helper; post '/forgot' => sub { - my $user = database->quick_select( - "user", - { - "email" => param("email"), - }, - ); + my $user = database->quick_select( + "user", + { + "email" => param("email"), + }, + ); - if (!$user) { - return template 'forgot' => { - err => 1, - e_no_user => 1, - }; - } + if (!$user) { + return template 'forgot' => { + err => 1, + e_no_user => 1, + }; + } - my $token = randstring(32); - database->quick_update( - "user", - { - "id" => $user->{"id"}, - }, - { - "recoverytoken" => $token, - }, - ); + my $token = randstring(32); + database->quick_update( + "user", + { + "id" => $user->{"id"}, + }, + { + "recoverytoken" => $token, + }, + ); - my $email = template 'email/forgot' => { - "link" => config->{"mail"}->{"baseurl"} . "/confirm_forgot?e=" . uri_escape(param("email")) . "&t=$token", - }, - { - "layout" => undef, - }; - send_email(param("email"), $email); + my $email = template 'email/forgot' => { + "link" => config->{"mail"}->{"baseurl"} . "/confirm_forgot?e=" . uri_escape(param("email")) . "&t=$token", + }, + { + "layout" => undef, + }; + send_email(param("email"), $email); - template 'forgot' => { - success => 1, - }; + template 'forgot' => { + success => 1, + }; }; post '/confirm_forgot' => sub { - my %errs; + my %errs; - if (!param("e") || !param("t")) { - $errs{"e_bad_link"} = 1; - } elsif (!param("password")) { - $errs{"e_no_pass"} = 1; - } elsif (length(param("password")) < 8) { - $errs{"e_pass_len"} = 1; - } elsif (param("password") ne param("password2")) { - $errs{"e_pass_mismatch"} = 1; - } + if (!param("e") || !param("t")) { + $errs{"e_bad_link"} = 1; + } elsif (!param("password")) { + $errs{"e_no_pass"} = 1; + } elsif (length(param("password")) < 8) { + $errs{"e_pass_len"} = 1; + } elsif (param("password") ne param("password2")) { + $errs{"e_pass_mismatch"} = 1; + } - if (scalar(keys(%errs)) == 0) { - my $user = database->quick_select( - "user", - { - "email" => param("e"), - "recoverytoken" => param("t"), - }, - ); + if (scalar(keys(%errs)) == 0) { + my $user = database->quick_select( + "user", + { + "email" => param("e"), + "recoverytoken" => param("t"), + }, + ); - if (!$user) { - $errs{"e_bad_link"} = 1; - } else { - # Update the password - my ($hash, $salt) = hash_password(param "password"); - database->quick_update( - "user", - { - "id" => $user->{"id"}, - }, - { - "password" => $hash, - "salt" => $salt, - }, - ); + if (!$user) { + $errs{"e_bad_link"} = 1; + } else { + # Update the password + my ($hash, $salt) = hash_password(param "password"); + database->quick_update( + "user", + { + "id" => $user->{"id"}, + }, + { + "password" => $hash, + "salt" => $salt, + }, + ); - database->quick_delete( - "session", - { - "uid" => $user->{"id"}, - }, - ); + database->quick_delete( + "session", + { + "uid" => $user->{"id"}, + }, + ); - database->quick_update( - "user", - { - "id" => $user->{"id"}, - }, - { - "recoverytoken" => "", - }, - ); - } - } + database->quick_update( + "user", + { + "id" => $user->{"id"}, + }, + { + "recoverytoken" => "", + }, + ); + } + } - if (scalar(keys(%errs)) != 0) { - return template 'confirm_forgot' => { - "err" => 1, - %errs, - }; - } + if (scalar(keys(%errs)) != 0) { + return template 'confirm_forgot' => { + "err" => 1, + %errs, + }; + } - template 'redir' => { - "redir" => "login?pwchange=1", - }; + template 'redir' => { + "redir" => "login?pwchange=1", + }; }; true; diff --git a/lib/cyberman/Helper.pm b/lib/cyberman/Helper.pm index 5207f43..c4f1e23 100644 --- a/lib/cyberman/Helper.pm +++ b/lib/cyberman/Helper.pm @@ -15,80 +15,80 @@ our @EXPORT = qw(auth_test randstring hash_password check_name send_email); # Helper functions sub auth_test { - my $id = undef; - if (@_) { - $id = shift; - } + my $id = undef; + if (@_) { + $id = shift; + } - if (!vars->{"auth"}) { - return template 'redir' => { - "redir" => "/index", - }; - } elsif ($id && vars->{"auth"} != $id) { - return template 'redir' => { - "redir" => "/index", - }; - } else { - return 0; # nothing to be returned, route can continue - } + if (!vars->{"auth"}) { + return template 'redir' => { + "redir" => "/index", + }; + } elsif ($id && vars->{"auth"} != $id) { + return template 'redir' => { + "redir" => "/index", + }; + } else { + return 0; # nothing to be returned, route can continue + } } sub randstring { - my $len = shift; + my $len = shift; - my @chars = (0..9, "a".."z", "A".."Z"); - my $ret; + my @chars = (0..9, "a".."z", "A".."Z"); + my $ret; - for (1..$len) { - $ret .= $chars[irand(scalar(@chars))]; - } - return $ret; + for (1..$len) { + $ret .= $chars[irand(scalar(@chars))]; + } + return $ret; } sub hash_password { - my $plaintext = shift; + my $plaintext = shift; - my $salt; - if (scalar(@_) > 0) { - $salt = shift; - } else { - $salt = randstring(16); - } + my $salt; + if (scalar(@_) > 0) { + $salt = shift; + } else { + $salt = randstring(16); + } - my $b = new Digest::Bcrypt; - $b->cost(8); - $b->salt($salt); - $b->add($plaintext); + my $b = new Digest::Bcrypt; + $b->cost(8); + $b->salt($salt); + $b->add($plaintext); - return ($b->bcrypt_b64digest, $salt); + return ($b->bcrypt_b64digest, $salt); } sub check_name { - my $name = shift; - if ($name =~ m/^[a-z0-9]([a-z0-9\-_]*[a-z0-9])?$/) { - return 1; - } else { - return 0; - } + my $name = shift; + if ($name =~ m/^[a-z0-9]([a-z0-9\-_]*[a-z0-9])?$/) { + return 1; + } else { + return 0; + } } sub send_email { - my $addy = shift; - my $body = shift; + my $addy = shift; + my $body = shift; - # TODO: this function is quick and dirty to get this - # online - it needs to be rewritten so it doesn't block the thread!! + # TODO: this function is quick and dirty to get this + # online - it needs to be rewritten so it doesn't block the thread!! - my $email = Email::Simple->create( - header => [ - To => $addy, - From => config->{"mail"}->{"from"}, - Subject => "Confirm your email address", - ], - body => $body, - ); + my $email = Email::Simple->create( + header => [ + To => $addy, + From => config->{"mail"}->{"from"}, + Subject => "Confirm your email address", + ], + body => $body, + ); - sendmail($email) if config->{"mail"}->{"enabled"}; + sendmail($email) if config->{"mail"}->{"enabled"}; } 1; diff --git a/lib/cyberman/Records.pm b/lib/cyberman/Records.pm index 285f029..929e8a3 100644 --- a/lib/cyberman/Records.pm +++ b/lib/cyberman/Records.pm @@ -7,168 +7,168 @@ use Switch; use cyberman::Helper; get '/domains/:name/records' => sub { - my $domain = database->quick_select( - "domain", - { - "name" => param("name"), - }, - ); + my $domain = database->quick_select( + "domain", + { + "name" => param("name"), + }, + ); - if (!$domain) { - return "No such domain!"; - } + if (!$domain) { + return "No such domain!"; + } - return auth_test($domain->{"ownerid"}) if auth_test($domain->{"ownerid"}); + return auth_test($domain->{"ownerid"}) if auth_test($domain->{"ownerid"}); - my @records = database->quick_select( - "record", - { - "domainid" => $domain->{"id"}, - }, - ); + my @records = database->quick_select( + "record", + { + "domainid" => $domain->{"id"}, + }, + ); - template 'records' => { - domain => $domain, - records => \@records, - }; + template 'records' => { + domain => $domain, + records => \@records, + }; }; get '/domains/:name/records/add' => sub { - my $domain = database->quick_select( - "domain", - { - "name" => param("name"), - }, - ); + my $domain = database->quick_select( + "domain", + { + "name" => param("name"), + }, + ); - if (!$domain) { - return "No such domain!"; - } + if (!$domain) { + return "No such domain!"; + } - return auth_test($domain->{"ownerid"}) if auth_test($domain->{"ownerid"}); + return auth_test($domain->{"ownerid"}) if auth_test($domain->{"ownerid"}); - template 'records/add' => { - domain => $domain, - }; + template 'records/add' => { + domain => $domain, + }; }; post '/domains/:name/records/add' => sub { - my $domain = database->quick_select( - "domain", - { - "name" => param("name"), - }, - ); + my $domain = database->quick_select( + "domain", + { + "name" => param("name"), + }, + ); - if (!$domain) { - return "No such domain!"; - } + if (!$domain) { + return "No such domain!"; + } - return auth_test($domain->{"ownerid"}) if auth_test($domain->{"ownerid"}); + return auth_test($domain->{"ownerid"}) if auth_test($domain->{"ownerid"}); - my %errs; + my %errs; - # tw overuse of regex + # tw overuse of regex - switch (param("type")) { - case "A" { - if (param("value") !~ m/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4}$/) { - # here we go... - $errs{"e_bad_value"} = 1; - } - } - case "AAAA" { - if (param("value") !~ m/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/) { - # I am sorry - $errs{"e_bad_value"} = 1; - } - } - case "NS" { - if (param("value") !~ m/^([a-zA-Z0-9]([a-zA-Z0-9-_]*[a-zA-Z0-9])?\.)+$/) { - $errs{"e_bad_value"} = 1; - } - } - else { - $errs{"e_bad_type"} = 1; - } - } + switch (param("type")) { + case "A" { + if (param("value") !~ m/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4}$/) { + # here we go... + $errs{"e_bad_value"} = 1; + } + } + case "AAAA" { + if (param("value") !~ m/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/) { + # I am sorry + $errs{"e_bad_value"} = 1; + } + } + case "NS" { + if (param("value") !~ m/^([a-zA-Z0-9]([a-zA-Z0-9-_]*[a-zA-Z0-9])?\.)+$/) { + $errs{"e_bad_value"} = 1; + } + } + else { + $errs{"e_bad_type"} = 1; + } + } - if (param("rname") !~ m/^(@|([a-zA-Z0-9]([a-zA-Z0-9-_]*[a-zA-Z0-9])?\.)*[a-zA-Z0-9]([a-zA-Z0-9-_]*[a-zA-Z0-9])?)$/) { - $errs{"e_bad_name"} = 1; - } + if (param("rname") !~ m/^(@|([a-zA-Z0-9]([a-zA-Z0-9-_]*[a-zA-Z0-9])?\.)*[a-zA-Z0-9]([a-zA-Z0-9-_]*[a-zA-Z0-9])?)$/) { + $errs{"e_bad_name"} = 1; + } - if (scalar(keys(%errs)) != 0) { - return template 'records/add' => { - domain => $domain, - %errs, - error => 1, - }; - } + if (scalar(keys(%errs)) != 0) { + return template 'records/add' => { + domain => $domain, + %errs, + error => 1, + }; + } - my $sid = $domain->{"lastsid"} + 1; - database->quick_update( - "domain", - { - "id" => $domain->{"id"}, - }, - { - "lastsid" => $sid, - }, - ); + my $sid = $domain->{"lastsid"} + 1; + database->quick_update( + "domain", + { + "id" => $domain->{"id"}, + }, + { + "lastsid" => $sid, + }, + ); - database->quick_insert( - "record", - { - "sid" => $sid, - "domainid" => $domain->{"id"}, - "type" => param("type"), - "name" => param("rname"), - "value" => param("value"), - }, - ); + database->quick_insert( + "record", + { + "sid" => $sid, + "domainid" => $domain->{"id"}, + "type" => param("type"), + "name" => param("rname"), + "value" => param("value"), + }, + ); - template 'redir' => { - "redir" => "../records?added=1", - }; + template 'redir' => { + "redir" => "../records?added=1", + }; }; post '/domains/:name/records/:sid/remove' => sub { - my $domain = database->quick_select( - "domain", - { - "name" => param("name"), - }, - ); + my $domain = database->quick_select( + "domain", + { + "name" => param("name"), + }, + ); - if (!$domain) { - return "No such domain!"; - } + if (!$domain) { + return "No such domain!"; + } - return auth_test($domain->{"ownerid"}) if auth_test($domain->{"ownerid"}); + return auth_test($domain->{"ownerid"}) if auth_test($domain->{"ownerid"}); - my $record = database->quick_select( - "record", - { - "domainid" => $domain->{"id"}, - "sid" => param("sid"), - }, - ); + my $record = database->quick_select( + "record", + { + "domainid" => $domain->{"id"}, + "sid" => param("sid"), + }, + ); - if (!$record) { - return "No such record!"; - } + if (!$record) { + return "No such record!"; + } - database->quick_delete( - "record", - { - "domainid" => $domain->{"id"}, - "sid" => param("sid"), - }, - ); + database->quick_delete( + "record", + { + "domainid" => $domain->{"id"}, + "sid" => param("sid"), + }, + ); - template 'redir' => { - "redir" => "../../records?removed=1", - }; + template 'redir' => { + "redir" => "../../records?removed=1", + }; }; true; diff --git a/public/css/style.css b/public/css/style.css index 2390533..1221fef 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -1,55 +1,55 @@ * { - margin: 0; + margin: 0; } body, a { - background-color: black; - font-family: monospace; - color: white; - font-size: 14px; - line-height: 1.6em; + background-color: black; + font-family: monospace; + color: white; + font-size: 14px; + line-height: 1.6em; } p { - margin-bottom: 0.8em; + margin-bottom: 0.8em; } .body { - max-width: 700px; - margin-left: auto; - margin-right: auto; + max-width: 700px; + margin-left: auto; + margin-right: auto; } .toolbar { - border: 1px solid white; + border: 1px solid white; } a.bracketButton { - text-decoration: none; + text-decoration: none; } a.bracketButton:hover { - text-decoration: underline; + text-decoration: underline; } button.textButton { - background: none !important; - color: inherit; - border: none; - padding: 0 !important; - font: inherit; - cursor: pointer; + background: none !important; + color: inherit; + border: none; + padding: 0 !important; + font: inherit; + cursor: pointer; } button.textButton:hover { - text-decoration: underline; + text-decoration: underline; } form.login>table>tbody>tr>td>label { - margin-right: 10px; + margin-right: 10px; } table.domains { - width: 100%; + width: 100%; } table.domains td:first-child { - width: 50%; + width: 50%; } .msgBox { - border: 1px solid white; - display: inline-block; - padding: 10px; + border: 1px solid white; + display: inline-block; + padding: 10px; } diff --git a/public/js/domain_check.js b/public/js/domain_check.js index 9903415..129302e 100644 --- a/public/js/domain_check.js +++ b/public/js/domain_check.js @@ -1,23 +1,23 @@ function updateAvailability() { - if (this.responseText === "y") { - document.getElementById("avail").innerHTML = "Available!"; - } else { - document.getElementById("avail").innerHTML = "Not available"; - } + if (this.responseText === "y") { + document.getElementById("avail").innerHTML = "Available!"; + } else { + document.getElementById("avail").innerHTML = "Not available"; + } } function checkAvailability() { - var name = document.getElementById("name").value; + var name = document.getElementById("name").value; - if (name === "") { - document.getElementById("avail").innerHTML = ""; - return - } + if (name === "") { + document.getElementById("avail").innerHTML = ""; + return + } - document.getElementById("avail").innerHTML = "Checking availability..."; + document.getElementById("avail").innerHTML = "Checking availability..."; - var req = new XMLHttpRequest(); - req.addEventListener("load", updateAvailability); - req.open("GET", "/api/check_availability?name="+encodeURIComponent(name)); - req.send(); + var req = new XMLHttpRequest(); + req.addEventListener("load", updateAvailability); + req.open("GET", "/api/check_availability?name="+encodeURIComponent(name)); + req.send(); } diff --git a/schema.sql b/schema.sql index 17c3222..22aab97 100644 --- a/schema.sql +++ b/schema.sql @@ -1,44 +1,44 @@ drop table if exists cyberman; create table cyberman ( - id integer primary key, - dbrev integer not null + id integer primary key, + dbrev integer not null ); insert into cyberman (dbrev) values (3); drop table if exists user; create table user ( - id integer primary key, - email text not null, - password text not null, - salt text not null, - active integer not null default 0, - conftoken text not null, - newemail text, - recoverytoken text + id integer primary key, + email text not null, + password text not null, + salt text not null, + active integer not null default 0, + conftoken text not null, + newemail text, + recoverytoken text ); drop table if exists session; create table session ( - id integer primary key, - uid integer not null, - since integer not null, - token text not null + id integer primary key, + uid integer not null, + since integer not null, + token text not null ); drop table if exists domain; create table domain ( - id integer primary key, - name string not null, - ownerid integer not null, - lastsid integer not null default 0 + id integer primary key, + name string not null, + ownerid integer not null, + lastsid integer not null default 0 ); drop table if exists record; create table record ( - id integer primary key, - sid integer not null, - domainid integer not null, - type string not null, - name string not null, - value string not null + id integer primary key, + sid integer not null, + domainid integer not null, + type string not null, + name string not null, + value string not null ); diff --git a/views/account.tt b/views/account.tt index 8165bc2..9eca399 100644 --- a/views/account.tt +++ b/views/account.tt @@ -1,79 +1,79 @@
-
-

Your Account

-
- <% IF updated %> -
- Your account details were updated successfully. If you updated your email address, you need to click the link sent to you before the changes can be applied. -
-

- <% END %> +
+

Your Account

+
+ <% IF updated %> +
+ Your account details were updated successfully. If you updated your email address, you need to click the link sent to you before the changes can be applied. +
+

+ <% END %>
<% IF error %>
-
- There were some problems with your submission: -
-
    - <% IF e_no_email %> -
  • You need too enter a valid email address.
  • - <% END %> - <% IF e_wrong_pass %> -
  • The password you entered is incorrect.
  • - <% END %> - <% IF e_pass_mismatch %> -
  • The two passwords you entered do not match.
  • - <% END %> - <% IF e_pass_len %> -
  • Your password must be at least 8 characters long.
  • - <% END %> - <% IF e_email_exists %> -
  • There is already an account with that email address.
  • - <% END %> -
-
+
+ There were some problems with your submission: +
+
    + <% IF e_no_email %> +
  • You need too enter a valid email address.
  • + <% END %> + <% IF e_wrong_pass %> +
  • The password you entered is incorrect.
  • + <% END %> + <% IF e_pass_mismatch %> +
  • The two passwords you entered do not match.
  • + <% END %> + <% IF e_pass_len %> +
  • Your password must be at least 8 characters long.
  • + <% END %> + <% IF e_email_exists %> +
  • There is already an account with that email address.
  • + <% END %> +
+

<% END %>
-
- - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - - -
- - - -
-
- [  ] -
+
+ + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + + +
+
+ [  ] +
diff --git a/views/charter.tt b/views/charter.tt index 47adea5..c194809 100644 --- a/views/charter.tt +++ b/views/charter.tt @@ -1,11 +1,11 @@
-
-

.cyb charter

-
+
+

.cyb charter

+
-
+	
 Description
 - - - - - -
 
@@ -48,5 +48,5 @@ Contacts
 * DNS master - hostmaster@opennic.cyb
 * Abuse -  abuse@opennic.cyb
 * Webmaster - webmaster@opennic.cyb
-  
+
diff --git a/views/confirm_forgot.tt b/views/confirm_forgot.tt index 1408ef2..9e986b4 100644 --- a/views/confirm_forgot.tt +++ b/views/confirm_forgot.tt @@ -1,49 +1,49 @@
-
-

Update your password

-
- <% IF err %> -
- Error: - <% IF e_bad_link %> - The link you clicked on is invalid! - <% ELSIF e_no_pass %> - You must enter a password. - <% ELSIF e_pass_len %> - Your password must be at least 8 characters long. - <% ELSIF e_pass_mismatch %> - The two passwords you entered do not match. - <% END%> -
-

- <% END %> +
+

Update your password

+
+ <% IF err %> +
+ Error: + <% IF e_bad_link %> + The link you clicked on is invalid! + <% ELSIF e_no_pass %> + You must enter a password. + <% ELSIF e_pass_len %> + Your password must be at least 8 characters long. + <% ELSIF e_pass_mismatch %> + The two passwords you entered do not match. + <% END%> +
+

+ <% END %>
- Enter a new password and click update. -
- + Enter a new password and click update. +
+
diff --git a/views/confirmed.tt b/views/confirmed.tt index 85bf3a2..c5abb54 100644 --- a/views/confirmed.tt +++ b/views/confirmed.tt @@ -1,9 +1,9 @@
-
-

Success

-
+
+

Success

+
- Your email address was confirmed successfully. + Your email address was confirmed successfully.
diff --git a/views/domains.tt b/views/domains.tt index 9c2a5ae..68260e4 100644 --- a/views/domains.tt +++ b/views/domains.tt @@ -1,62 +1,62 @@
-
-

Your Domains

-
- - <% IF params.new %> -
- The domain '<% params.new | html_entity %>.<% vars.config.tld %>' was registered successfully! -
-

- <% END %> - <% IF params.removed %> -
- The domain '<% params.removed | html_entity %>.<% vars.config.tld %>' was removed successfully. -
-

- <% END %> +
+

Your Domains

+
+ + <% IF params.new %> +
+ The domain '<% params.new | html_entity %>.<% vars.config.tld %>' was registered successfully! +
+

+ <% END %> + <% IF params.removed %> +
+ The domain '<% params.removed | html_entity %>.<% vars.config.tld %>' was removed successfully. +
+

+ <% END %>
-
- [ register a domain ] -
+
+ [ register a domain ] +
- <% IF domains.size > 0 %> - - <% domains.size %> - <% IF domains.size == 1 %> - domain - <% ELSE %> - domains - <% END %> - + <% IF domains.size > 0 %> + + <% domains.size %> + <% IF domains.size == 1 %> + domain + <% ELSE %> + domains + <% END %> + -
+
- - - - - - <% FOREACH d IN domains %> - - - - - <% END %> -
- Domain name - - Actions -
- <% d.name | html_entity %>.<% vars.config.tld %> - - [ edit ] - [ remove ] -
+ + + + + + <% FOREACH d IN domains %> + + + + + <% END %> +
+ Domain name + + Actions +
+ <% d.name | html_entity %>.<% vars.config.tld %> + + [ edit ] + [ remove ] +
- <% ELSE %> - You don't have any domains registered. - <% END %> + <% ELSE %> + You don't have any domains registered. + <% END %>
diff --git a/views/domains/new.tt b/views/domains/new.tt index 38b6048..c2139e0 100644 --- a/views/domains/new.tt +++ b/views/domains/new.tt @@ -1,40 +1,40 @@
-
-

Register a domain

-
+
+

Register a domain

+
<% IF error %>
-
- <% IF e_no_name %> - You did not specify a domain to register. - <% END %> - <% IF e_exists %> - The domain '<% params.name | html_entity %>.<% vars.config.tld %>' has already been registered. Please choose a different domain name. - <% END %> - <% IF e_chars %> - The domain '<% params.name | html_entity %>.<% vars.config.tld %>' contains invalid characters. - <% END %> - <% IF e_reserved %> - The domain '<% params.name | html_entity %>.<% vars.config.tld %>' is reserved for use by the registry. - <% END %> -
-

+
+ <% IF e_no_name %> + You did not specify a domain to register. + <% END %> + <% IF e_exists %> + The domain '<% params.name | html_entity %>.<% vars.config.tld %>' has already been registered. Please choose a different domain name. + <% END %> + <% IF e_chars %> + The domain '<% params.name | html_entity %>.<% vars.config.tld %>' contains invalid characters. + <% END %> + <% IF e_reserved %> + The domain '<% params.name | html_entity %>.<% vars.config.tld %>' is reserved for use by the registry. + <% END %> +
+

<% END %>
- Please choose a domain to register: -

+ Please choose a domain to register: +

- - + +
diff --git a/views/domains/remove.tt b/views/domains/remove.tt index 6a5f40e..f0f7fae 100644 --- a/views/domains/remove.tt +++ b/views/domains/remove.tt @@ -1,32 +1,32 @@ <% IF domain %>
-
-

Removal of <% domain.name %>.<% vars.config.tld %>

-
+
+

Removal of <% domain.name %>.<% vars.config.tld %>

+
-

- You are about to permanently remove <% domain.name %>.<% vars.config.tld %> and all its records. -

-

- YOU ARE ABOUT TO PERMANENTLY REMOVE <% domain.name %>.<% vars.config.tld %> AND ALL ITS RECORDS! -

-

- There is no guarantee that you will be able to re-register this domain at a later date. -

-

-

-
- [  ] -
-
-

+

+ You are about to permanently remove <% domain.name %>.<% vars.config.tld %> and all its records. +

+

+ YOU ARE ABOUT TO PERMANENTLY REMOVE <% domain.name %>.<% vars.config.tld %> AND ALL ITS RECORDS! +

+

+ There is no guarantee that you will be able to re-register this domain at a later date. +

+

+

+
+ [  ] +
+
+

<% ELSE %>
- No such domain! -
- [ go back ] + No such domain! +
+ [ go back ]
<% END %> diff --git a/views/forgot.tt b/views/forgot.tt index 01e78e9..cad7bbc 100644 --- a/views/forgot.tt +++ b/views/forgot.tt @@ -1,27 +1,27 @@
-
-

Forgotten password

-
- <% IF err || success %> -
- <% IF e_no_user %> - Error: There is no user account associated with that email address. - <% END %> - <% IF success %> - An email has been sent to <% params.email | html_entity %>. Please click the link to reset your password. - <% END %> -
-

- <% END %> +
+

Forgotten password

+
+ <% IF err || success %> +
+ <% IF e_no_user %> + Error: There is no user account associated with that email address. + <% END %> + <% IF success %> + An email has been sent to <% params.email | html_entity %>. Please click the link to reset your password. + <% END %> +
+

+ <% END %>
- Enter your email into the field below and we'll send an email with a link to reset your password. -
-
- - -
- [  ] -
+ Enter your email into the field below and we'll send an email with a link to reset your password. +
+
+ + +
+ [  ] +
diff --git a/views/index.tt b/views/index.tt index ef17ac9..33cf8f3 100644 --- a/views/index.tt +++ b/views/index.tt @@ -1,15 +1,15 @@
-


-

Welcome to cybNIC

+


+

Welcome to cybNIC


-

.cyb is a new TLD (top level domain) for anything and everything cyberpunk-related, on the OpenNIC network. To get started, change your computer's DNS settings to use OpenNIC's servers - here's how. Registering a .cyb domain is free for everyone.

-

You can read our charter for more information and details on how to report abuse of cybNIC services.

-

Create or log in to an account in order to register or update .cyb domains.

-
-

log in ]  [ register ]

-
+

.cyb is a new TLD (top level domain) for anything and everything cyberpunk-related, on the OpenNIC network. To get started, change your computer's DNS settings to use OpenNIC's servers - here's how. Registering a .cyb domain is free for everyone.

+

You can read our charter for more information and details on how to report abuse of cybNIC services.

+

Create or log in to an account in order to register or update .cyb domains.

+
+

log in ]  [ register ]

+
diff --git a/views/layouts/main.tt b/views/layouts/main.tt index 1683065..4b161a8 100644 --- a/views/layouts/main.tt +++ b/views/layouts/main.tt @@ -1,31 +1,31 @@ - - - - <% IF redir %> - - <% END %> - cybNIC - - - - <% IF vars.auth %> -
-
- - Logged in as <% vars.email | html_entity %> - - -
- [ domains ] - [ account ] - [  ] -
-
-
-
- <% END %> - <% content %> - + + + + <% IF redir %> + + <% END %> + cybNIC + + + + <% IF vars.auth %> +
+
+ + Logged in as <% vars.email | html_entity %> + + +
+ [ domains ] + [ account ] + [  ] +
+
+
+
+ <% END %> + <% content %> + diff --git a/views/login.tt b/views/login.tt index 8123cd2..ad207c6 100644 --- a/views/login.tt +++ b/views/login.tt @@ -1,63 +1,63 @@
-
-

Log in

-
+
+

Log in

+
- <% IF account_created %> -
- Your account has been created and a confirmation email sent to <% params.email | html_entity %>. Please confirm your email address, then log in here. -
-

- <% END %> - - <% IF params.pwchange %> -
- Your password has been changed and all browsers logged out. Please log in again here. -
-

- <% END %> + <% IF account_created %> +
+ Your account has been created and a confirmation email sent to <% params.email | html_entity %>. Please confirm your email address, then log in here. +
+

+ <% END %> - <% IF error %> -
- <% IF e_no_user %> - The email address <% params.email | html_entity %> is not registered. - <% END %> - <% IF e_pass %> - Your password was incorrect, sorry. - <% END %> - <% IF e_not_confirmed %> - Please confirm your email address using the link sent to <% params.email | html_entity %>. - <% END %> -
-

- <% END %> + <% IF params.pwchange %> +
+ Your password has been changed and all browsers logged out. Please log in again here. +
+

+ <% END %> + + <% IF error %> +
+ <% IF e_no_user %> + The email address <% params.email | html_entity %> is not registered. + <% END %> + <% IF e_pass %> + Your password was incorrect, sorry. + <% END %> + <% IF e_not_confirmed %> + Please confirm your email address using the link sent to <% params.email | html_entity %>. + <% END %> +
+

+ <% END %>
- +
diff --git a/views/records/add.tt b/views/records/add.tt index bc307b7..68b8d35 100644 --- a/views/records/add.tt +++ b/views/records/add.tt @@ -1,75 +1,75 @@
-
-

Add a record

-
+
+

Add a record

+
<% IF error %>
-
- There were some problems with your submission: -
-
    - <% IF e_bad_value %> -
  • The value you entered was invalid. - <% IF params.type == 'NS' %>(Did you forget the trailing '.'?)<% END %>
  • - <% END %> - <% IF e_bad_type %> -
  • You must choose a type for the record.
  • - <% END %> - <% IF e_bad_name %> -
  • The name of the record is invalid.
  • - <% END %> -
-
+
+ There were some problems with your submission: +
+
    + <% IF e_bad_value %> +
  • The value you entered was invalid. + <% IF params.type == 'NS' %>(Did you forget the trailing '.'?)<% END %>
  • + <% END %> + <% IF e_bad_type %> +
  • You must choose a type for the record.
  • + <% END %> + <% IF e_bad_name %> +
  • The name of the record is invalid.
  • + <% END %> +
+

<% END %>
- Adding a record for <% domain.name | html_entity %>.<% vars.config.tld %> + Adding a record for <% domain.name | html_entity %>.<% vars.config.tld %> - +
diff --git a/views/redir.tt b/views/redir.tt index a4a9413..d6f5694 100644 --- a/views/redir.tt +++ b/views/redir.tt @@ -1,3 +1,3 @@
- Redirecting, please wait. + Redirecting, please wait.
diff --git a/views/register.tt b/views/register.tt index ff6ad15..238bb64 100644 --- a/views/register.tt +++ b/views/register.tt @@ -1,71 +1,71 @@
-
-

Register

-
+
+

Register

+
<% IF error %>
-
- There were some problems with your registration: -
-
    - <% IF e_no_email %> -
  • You need to enter a valid email address.
  • - <% END %> - <% IF e_no_password %> -
  • You need to enter a password.
  • - <% END %> - <% IF e_pass_len %> -
  • Your password must be at least 8 characters!
  • - <% END %> - <% IF e_no_password2 %> -
  • You need to enter a password confirmation.
  • - <% END %> - <% IF e_pass_match %> -
  • The two passwords you entered do not match!
  • - <% END %> - <% IF e_email_exists %> -
  • There is already an account with that email address.
  • - <% END %> -
-
+
+ There were some problems with your registration: +
+
    + <% IF e_no_email %> +
  • You need to enter a valid email address.
  • + <% END %> + <% IF e_no_password %> +
  • You need to enter a password.
  • + <% END %> + <% IF e_pass_len %> +
  • Your password must be at least 8 characters!
  • + <% END %> + <% IF e_no_password2 %> +
  • You need to enter a password confirmation.
  • + <% END %> + <% IF e_pass_match %> +
  • The two passwords you entered do not match!
  • + <% END %> + <% IF e_email_exists %> +
  • There is already an account with that email address.
  • + <% END %> +
+

<% END %>
- +