fix: make success message relevant

This commit is contained in:
Mrugesh Mohapatra
2018-05-29 02:23:19 +05:30
parent 5f8eb3615a
commit c0156b41e2
3 changed files with 58 additions and 63 deletions

View File

@ -576,14 +576,9 @@ module.exports = function(User) {
this.update$({ emailAuthLinkTTL }) this.update$({ emailAuthLinkTTL })
); );
}) })
.map(() => isSignUp ? .map(() =>
dedent` dedent`
We created a new account for you! Check your email and click the link we sent you to confirm you email.
Check your email and click the sign in link we sent you.
` :
dedent`
We found your existing account.
Check your email and click the sign in link we sent you.
` `
); );
} }

View File

@ -1,12 +1,12 @@
extends ../layout extends ../layout
block content block content
.container .row.flashMessage.negative-30
.row.flashMessage.negative-30 .col-xs-12.col-sm-8.col-sm-offset-2.col-md-6.col-md-offset-3
.col-sm-6.col-sm-offset-3 #flash-board.alert.fade.in(style='display: none;')
#flash-board.alert.fade.in(style='display: none;') button.close(type='button', data-dismiss='alert')
button.close(type='button', data-dismiss='alert') span.ion-close-circled#flash-close
span.ion-close-circled#flash-close #flash-content
#flash-content .row
.col-xs-12 .col-xs-12
#accept-privacy-terms #accept-privacy-terms
.row .row

View File

@ -1,57 +1,57 @@
extends ../layout extends ../layout
block content block content
.row.flashMessage.negative-30
.col-xs-12.col-sm-8.col-sm-offset-2.col-md-6.col-md-offset-3
#flash-board.alert.fade.in(style='display: none;')
button.close(type='button', data-dismiss='alert')
span.ion-close-circled#flash-close
#flash-content
.container .container
.row.flashMessage.negative-30 h2.text-center Update your email address here:
.col-xs-12 form.form-horizontal.update-email(method='POST', action='/update-my-email', name="updateEmailForm")
#flash-board.alert.fade.in(style='display: none;') .row
button.close(type='button', data-dismiss='alert') .col-sm-6.col-sm-offset-3
span.ion-close-circled#flash-close input(type='hidden', name='_csrf', value=_csrf)
#flash-content .form-group
h2.text-center Update your email address here: input.input-lg.form-control(type='email', name='email', id='email', value=user.email || '', placeholder=user.email || 'Enter your new email', autofocus, required, autocomplete="off")
form.form-horizontal.update-email(method='POST', action='/update-my-email', name="updateEmailForm") .form-group
.row button.btn.btn-lg.btn-primary.btn-block(type='submit')= !user.email || user.emailVerified ? 'Update my Email' : 'Verify Email'
.col-sm-6.col-sm-offset-3 a.btn.btn-lg.btn-block.btn-primary.btn-link-social(href='/signout')
input(type='hidden', name='_csrf', value=_csrf) | Sign out
.form-group
input.input-lg.form-control(type='email', name='email', id='email', value=user.email || '', placeholder=user.email || 'Enter your new email', autofocus, required, autocomplete="off")
.form-group
button.btn.btn-lg.btn-primary.btn-block(type='submit')= !user.email || user.emailVerified ? 'Update my Email' : 'Verify Email'
a.btn.btn-lg.btn-block.btn-primary.btn-link-social(href='/signout')
| Sign out
script. script.
$(document).ready(function() { $(document).ready(function() {
$('form').submit(function(event){ $('form').submit(function(event){
event.preventDefault(); event.preventDefault();
$('#flash-board').hide(); $('#flash-board').hide();
var $form = $(event.target); var $form = $(event.target);
$.ajax({ $.ajax({
type : 'POST', type : 'POST',
url : $form.attr('action'), url : $form.attr('action'),
data : $form.serialize(), data : $form.serialize(),
dataType : 'json', dataType : 'json',
encode : true, encode : true,
xhrFields : { withCredentials: true } xhrFields : { withCredentials: true }
}) })
.fail(error => { .fail(error => {
if (error.responseText){ if (error.responseText){
var data = JSON.parse(error.responseText); var data = JSON.parse(error.responseText);
if(data.message) if(data.message)
$('#flash-content').html(data.message);
$('#flash-board')
.removeClass('alert-success')
.addClass('alert-info')
.fadeIn();
}
})
.done(data =>{
if(data && data.message){
$('#flash-content').html(data.message); $('#flash-content').html(data.message);
$('#flash-board') $('#flash-board')
.removeClass('alert-success') .removeClass('alert-info')
.addClass('alert-info') .addClass('alert-success')
.fadeIn(); .fadeIn();
} }
}) });
.done(data =>{
if(data && data.message){
$('#flash-content').html(data.message);
$('#flash-board')
.removeClass('alert-info')
.addClass('alert-success')
.fadeIn();
}
}); });
}); });
});