forked from .cyb/cyberman
Check for duplicate email addresses
This commit is contained in:
parent
cdab16e9db
commit
ecff4ac48e
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -28,9 +28,13 @@
|
|||
<% IF e_pass_len %>
|
||||
<li>Your password must be at least 8 characters long.</li>
|
||||
<% END %>
|
||||
<% IF e_email_exists %>
|
||||
<li>There is already an account with that email address.</li>
|
||||
<% END %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<% END %>
|
||||
|
||||
<div class="body">
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
<% IF e_pass_match %>
|
||||
<li>The two passwords you entered do not match!</li>
|
||||
<% END %>
|
||||
<% IF e_email_exists %>
|
||||
<li>There is already an account with that email address.</li>
|
||||
<% END %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue