diff --git a/lib/cyberman/Account.pm b/lib/cyberman/Account.pm index abfef5c..b974028 100644 --- a/lib/cyberman/Account.pm +++ b/lib/cyberman/Account.pm @@ -36,6 +36,19 @@ post '/account' => sub { $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("password") || param("npassword") || param("npassword2")) { $new_pass = 1; diff --git a/lib/cyberman/Auth.pm b/lib/cyberman/Auth.pm index f447858..797cad7 100644 --- a/lib/cyberman/Auth.pm +++ b/lib/cyberman/Auth.pm @@ -17,6 +17,17 @@ post '/register' => sub { } } + my $result = database->quick_select( + "user", + { + "email" => param("email"), + }, + ); + + 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; diff --git a/views/account.tt b/views/account.tt index 8442663..d3b523d 100644 --- a/views/account.tt +++ b/views/account.tt @@ -28,9 +28,13 @@ <% IF e_pass_len %>