diff --git a/app/assets/javascripts/users.js b/app/assets/javascripts/users.js index 322750ea1c..235f658825 100644 --- a/app/assets/javascripts/users.js +++ b/app/assets/javascripts/users.js @@ -89,3 +89,20 @@ var Profile = { }); } } + +class Reset { + validateEmail(sEmail){ + const filter = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + return filter.test(sEmail); + } + + runValidation(event){ + const email = $('#validEmail').val(); + + if(!this.validateEmail(email)) { + $("#validPrint").attr("style", "display:block"); + $("#validPrint").html("

Invalid email address

"); + event.preventDefault(); + } + } +} diff --git a/app/views/users/reset.html.erb b/app/views/users/reset.html.erb index 9d06ebd280..49bc01cb99 100644 --- a/app/views/users/reset.html.erb +++ b/app/views/users/reset.html.erb @@ -20,17 +20,25 @@ <% else %> -

<%= t('users.reset.enter_email_reset_password') %>:

-
+ + +
- +
<% end %> + +