Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Add Resend email button
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitpaulk committed Sep 12, 2014
1 parent 2e26da9 commit 1cb9a52
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
22 changes: 22 additions & 0 deletions js/gratipay/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,28 @@ Gratipay.account.init = function() {
$('.email').toggle();
$('.toggle-email').show();

return false;
}).on('click', '[type=resend]', function () {
var $this = $(this);
$this.css('opacity', 0.5);

function success(data) {
Gratipay.notification("We've sent a verification link to " + data.email , 'success');
$this.css('opacity', 1);
}

$.ajax({
url: '../email.json',
type: 'POST',
dataType: 'json',
success: success,
error: function (data) {
$this.css('opacity', 1);
Gratipay.notification('Failed to save your email address. '
+ 'Please try again.', 'error');
},
data: {email: $('input.email').val()}
})
return false;
});

Expand Down
5 changes: 5 additions & 0 deletions www/%username/account/index.html.spt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ locked = False
<button type="submit" class="email hidden">Save</button>
<button type="cancel" class="email cancel hidden">Cancel</button>
</div>
{% if participant.email and not participant.email.confirmed %}
<div class="buttons">
<button type="resend" class="email">Resend Email</button>
</div>
{% endif %}
</form>
</td>
<td class="account-action">
Expand Down

0 comments on commit 1cb9a52

Please sign in to comment.