Skip to content
This repository has been archived by the owner on Nov 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #169 from jbarrett/password-recovery-changes
Browse files Browse the repository at this point in the history
Password recovery changes
  • Loading branch information
jbarrett committed Jun 24, 2014
2 parents 9e3c1a3 + 3248a7d commit 8b57360
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
10 changes: 7 additions & 3 deletions lib/DDGC/Web/Controller/My.pm
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,14 @@ sub forgotpw :Chained('logged_out') :Args(0) {
}

$c->stash->{forgotpw_username} = lc($c->req->params->{username});
$c->stash->{forgotpw_email} = $c->req->params->{email};

my $user = $c->d->find_user($c->stash->{forgotpw_username});
if (!$user || !$user->data || !$user->data->{email} || $c->stash->{forgotpw_email} ne $user->data->{email}) {
$c->stash->{wrong_user_or_wrong_email} = 1;
if (!$user) {
$c->stash->{wrong_user} = 1;
return;
}
elsif (!$user->data || !$user->data->{email}) {
$c->stash->{no_email} = 1;
return;
}

Expand Down
17 changes: 10 additions & 7 deletions templates/my/forgotpw.tx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div class="notice error">
<i class="icn icon-warning-sign"></i>
You will receive the new password instructions from <b>[email protected]</b>. Please add this email to your contact list of your email account, to assure the email is not landing in the spam folder.
You will receive the new password instructions from <b>[email protected]</b>. Please add this email to your contact list of your email account, to assure the email is not landing in the spam folder.<br />
<b>Please note:</b> If you didn't link an email address to your account, then your password cannot be reset.
</div>

<: if $not_valid_username { :>
Expand All @@ -13,20 +14,22 @@
<h2>Request new password</h2>
<: if $sentok { :>
<p class="notice success">
<i class="icn icon-ok"></i> An email has been sent to you in order to confirm.
<i class="icn icon-ok"></i>An email has been sent with instructions on how to reset your password.
</p>
<: } else { :>
<: if $wrong_user_or_wrong_email { :>
<: if $wrong_user { :>
<p class="notice error">
<i class="icn icon-warning-sign"></i>The username and/or email is incorrect. Please, try again.
<i class="icn icon-warning-sign"></i>This username is not registered.
</p>
<: } :>
<: if $no_email { :>
<p class="notice error">
<i class="icn icon-warning-sign"></i>There is no email address associated with this account. Your password cannot be reset.
</p>
<: } :>
<div class="third">
<div class="input-wrap"><input placeholder="Your Username" type="text" name="username" value="<: $forgotpw_username :>" /></div>
</div>
<div class="third">
<div class="input-wrap"><input placeholder="Your Email Address" type="text" name="email" value="<: $forgotpw_email :>" /></div>
</div>
<div class="sixth">
<div class="input-wrap"><input type="submit" name="requestpw" class="button submit" value="Submit" /></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/my/register.tx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
</div>
<div class="half">
<label for="email" class="hide palm-block">Email</label>
<div class="input-wrap"><input type="text" placeholder="Your Email (Optional)" title="Your Email (Optional)" value="<: $email :>" name="email" class="text" /></div>
<div class="input-wrap"><input type="text" placeholder="Your Email (Optional - required for password recovery)" title="Your Email (Optional - required for password recovery)" value="<: $email :>" name="email" class="text" /></div>
</div>
<div class="emailagain">
<label for="emailagain" class="hide palm-block">If you see this, do not touch</label>
Expand Down

0 comments on commit 8b57360

Please sign in to comment.