FEATURE: Let users update their emails before confirming

This allows users who entered a typo or invalid email address when
signing up an opportunity to fix it and resending the confirmation
email to that address.
This commit is contained in:
Robin Ward
2017-04-05 16:14:22 -04:00
parent d1c79372d7
commit 40ab2e5667
19 changed files with 255 additions and 30 deletions

View File

@ -41,16 +41,40 @@ test("sign in - not activated", () => {
ok(!exists('.modal-body small'), 'it escapes the email address');
});
click('.modal-body .resend-link');
click('.modal-footer button.resend');
andThen(() => {
equal(find('.modal-body b').text(), '<small>current@example.com</small>');
ok(!exists('.modal-body small'), 'it escapes the email address');
});
});
});
test("sign in - not activated - edit email", () => {
visit("/");
andThen(() => {
click("header .login-button");
andThen(() => {
ok(exists('.login-modal'), "it shows the login modal");
});
fillIn('#login-account-name', 'eviltrout');
fillIn('#login-account-password', 'not-activated-edit');
click('.modal-footer .btn-primary');
click('.modal-footer button.edit-email');
andThen(() => {
equal(find('.activate-new-email').val(), 'current@example.com');
equal(find('.modal-footer .btn-primary:disabled').length, 1, "must change email");
});
fillIn('.activate-new-email', 'different@example.com');
andThen(() => {
equal(find('.modal-footer .btn-primary:disabled').length, 0);
});
click(".modal-footer .btn-primary");
andThen(() => {
equal(find('.modal-body b').text(), 'different@example.com');
});
});
});
test("create account", () => {
visit("/");

View File

@ -195,10 +195,18 @@ export default function() {
current_email: '<small>current@example.com</small>' });
}
if (data.password === 'not-activated-edit') {
return response({ error: "not active",
reason: "not_activated",
sent_to_email: 'eviltrout@example.com',
current_email: 'current@example.com' });
}
return response(400, {error: 'invalid login'});
});
this.post('/u/action/send_activation_email', success);
this.put('/u/update-activation-email', success);
this.get('/u/hp.json', function() {
return response({"value":"32faff1b1ef1ac3","challenge":"61a3de0ccf086fb9604b76e884d75801"});