Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Chrysweel committed Apr 17, 2015
2 parents 021c0dc + 770772a commit cf64a12
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG-0.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,7 @@ To get the diff between two versions, go to https://github.com/antwebes/ChateaCl

* 0.1.11 (2015-04-15)
* Include repeat form email to register and settings users
* Include check that two inputs of email are same with jquery
* Include check that two inputs of email are same with jquery

* 0.1.12(2015-04-17)
* Include translations to page re-send email confirmation & disable button when success this action
14 changes: 13 additions & 1 deletion Resources/public/js/resend-confirmation-email.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ var api_endpoint = window.api_endpoint;
$("#btn-resend-confirmation-email").on('click',function(event){
$("#div-resend-confirmation-email").removeClass('hide');
});

// if in template there are messages to translate, it translate otherwise show the error original
function transServerError(error){
if(typeof messages != 'undefined' && typeof messages.server_errors[error] != 'undefined'){
return messages.server_errors[error];
}
return error;
}


$("#form-resend-confirmation-email" ).submit(function( event ) {
event.preventDefault();
var userEmail = $("#inputEmailResend").val();
Expand All @@ -10,10 +20,12 @@ $("#form-resend-confirmation-email" ).submit(function( event ) {
type: 'get',
dataType:'json',
success: function (response) {
$("#succes-resend-confirmation-email").html('<div class="alert alert-success">'+response+'</div>');
$("#succes-resend-confirmation-email").html('<div class="alert alert-success">'+messages.success+'</div>');
$("[data-id=submit-confirm-email]").prop('disabled', true);
},
error: function(error){
var apiError = JSON.parse(error.responseText);
apiError.errors = transServerError(apiError.errors);
$("#succes-resend-confirmation-email").html('<div class="alert alert-danger">'+apiError.errors+'</div>');
}
});
Expand Down
3 changes: 2 additions & 1 deletion Resources/translations/UserRegistration.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ user.register.confirm.submit: "Submit"
user.register.i_need_help: "I need help"
user.register.confirmed.title: "Congratulations %username% !! Your account is activated successfully"
user.register.confirmed.message: "User %username% registered correctly . You can now start chatting."
user.register.invalid_client: "Due to tecnichal problems, it is impsible to register users now. Please contacto with the webmaster of this site."
user.register.invalid_client: "Due to tecnichal problems, it is impsible to register users now. Please contacto with the webmaster of this site."
user.confirm_email.not_owner_of_email: "This email is not associated with your User"
5 changes: 3 additions & 2 deletions Resources/translations/UserRegistration.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ user.register.click_to_confirm: "Haz click en el enlace enviado al correo para v
user.register.if_you_dont_confirm: "Si no verificas tu cuenta, no tendrás acceso a ciertas características o productos."
user.register.where_is_my_email: "¿Donde está mi correo de confirmación?"
user.register.we_sent_you_verification_mail: "Te hemos enviado un enlace de verificación a tu correo"
user.register.mail_not_in_inbox: "Si no tienes un mensaje en to bandeja de entrada, rellena tu cuenta de correo, rellena tu cuenta de correo para reenviarte un correo de confirmación!"
user.register.mail_not_in_inbox: "Si no tienes un mensaje en la bandeja de entrada de tu correo, revisa la bandeja de spam por si acaso te ha llegado allí. Si no es así, rellena aquí tu cuenta de correo con el que te has registrado para reenviarte otro correo de confirmación!"
user.register.your_mail: "Tu cuenta de correo"
user.register.write_your_mail: "Escribe to cuenta de correo para enviarte un correo para verificar la cuenta."
user.register.confirm.submit: "Enviar"
user.register.i_need_help: "Necesito ayuda"
user.register.confirmed.title: "Felicidadesa %username% !! Tu cuenta ha sido activada con éxiito"
user.register.confirmed.message: "Usuario %username% registrado correctament. Puedes empezar a chatear ahora."
user.register.invalid_client: "Debido a problemas técnicos en este momento nos es imposible realizar registros. Por favor pongase en contacto con el administrador de la web."
user.register.invalid_client: "Debido a problemas técnicos en este momento nos es imposible realizar registros. Por favor pongase en contacto con el administrador de la web."
user.confirm_email.not_owner_of_email: "El email introducido no está asociado a tu usuario"
8 changes: 7 additions & 1 deletion Resources/views/User/confirmEmail.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<label for="inputEmailResend">{{ "user.register.your_mail" | trans }}</label>
<input type="email" class="form-control" id="inputEmailResend" placeholder="{{ "user.register.write_your_mail" | trans }}" required="required">
</div>
<button type="submit" class="btn btn-default">{{ "user.register.confirm.submit" | trans }}</button>
<button type="submit" data-id="submit-confirm-email" class="btn btn-default">{{ "user.register.confirm.submit" | trans }}</button>
</form>
</div>

Expand Down Expand Up @@ -132,6 +132,12 @@
<script>
window.api_endpoint = "{{ api_endpoint }}";
window.token = "{{ userAccessToken }}";
var messages = {
success: '{{user.register.we_sent_you_verification_mail' | trans }}',
server_errors: {
'The email is not linked with your account': '{{ 'user.confirm_email.not_owner_of_email' | trans }}'
}
};
</script>
{% javascripts
'@ChateaClientBundle/Resources/public/js/resend-confirmation-email.js'
Expand Down

0 comments on commit cf64a12

Please sign in to comment.