Improved password reset screens, added missing translations.

This commit is contained in:
Martin Edenhofer 2012-11-12 14:51:51 +01:00
parent bbefa26980
commit e3604b4cec
3 changed files with 34 additions and 23 deletions

View file

@ -4,9 +4,9 @@ class Index extends App.Controller
className: 'container'
events:
'submit form': 'submit'
'submit form': 'submit'
'click .submit': 'submit'
'click .retry': 'rerender'
'click .retry': 'rerender'
constructor: ->
super
@ -17,26 +17,27 @@ class Index extends App.Controller
@render()
render: ->
render: (params) ->
configure_attributes = [
{ name: 'username', display: 'Enter your username or email address:', tag: 'input', type: 'text', limit: 100, null: false, class: 'input span4', },
{ name: 'username', display: 'Enter your username or email address', tag: 'input', type: 'text', limit: 100, null: false, class: 'input span4', },
]
@html App.view('reset_password')()
@html App.view('reset_password')(params)
new App.ControllerForm(
el: @el.find('#form-password')
@form = new App.ControllerForm(
el: @el.find('#form-password-item')
model: { configure_attributes: configure_attributes }
autofocus: true
)
rerender: (e) ->
e.preventDefault()
@render()
@el.find('#form-password').show()
submit: (e) ->
e.preventDefault()
params = @formParam(e.target)
@formDisable(e)
# get data
App.Com.ajax(
@ -50,16 +51,15 @@ class Index extends App.Controller
)
success: (data, status, xhr) =>
@html App.view('generic/hero_message')(
head: 'We\'ve sent password reset instructions to your email address'
message: 'If you don\'t receive instructions within a minute or two, check your email\'s spam and junk filters, or try <a href="#" class="retry">resending your request</a>.'
)
@render( sent: true )
@el.find('#form-password').hide()
error: (data, status, xhr) =>
@html App.view('generic/hero_message')(
head: 'Problem'
message: 'Username or email address invalid, please go back and try <a href="#" class="retry">again</a>.'
@notify(
type: 'error'
msg: App.i18n.translateContent( 'Username or email address invalid, please try again.' )
)
@formEnable( @el.find('#form-password') )
App.Config.set( 'reset_password', Index, 'Routes' )

View file

@ -1,10 +1,18 @@
<div class="hero-unit">
<h2><%- @T( 'Forgot your password?' ) %><small></small></h2>
<div class="container">
<form>
<p id="form-password"></p>
<a href="#/" class="btn cancel"><%- @T( 'Cancel' ) %></a>
<button class="btn btn-primary submit"><%- @T( 'Submit' ) %></button>
</form>
<% if @sent: %>
<h2><%- @T('We\'ve sent password reset instructions to your email address.') %><small></small></h2>
<div class="container">
<p><%- @T('If you don\'t receive instructions within a minute or two, check your email\'s spam and junk filters, or try resending your request.') %></p>
<a href="#" class="retry">&raquo; <%- @T('again') %> &laquo;</a>
</div>
<% end %>
<div id="form-password">
<h2><%- @T( 'Forgot your password?' ) %><small></small></h2>
<div class="container">
<form id="form-password-item">
<a href="#/" class="btn cancel"><%- @T( 'Cancel' ) %></a>
<button class="btn btn-primary submit"><%- @T( 'Submit' ) %></button>
</form>
</div>
</div>
</div>

View file

@ -1757,5 +1757,8 @@ Translation.create( :locale => 'de', :source => "Enter your username or email ad
Translation.create( :locale => 'de', :source => "Choose your new password.", :target => "Wählen Sie Ihr neues Passwort.", :updated_by_id => 1, :created_by_id => 1 )
Translation.create( :locale => 'de', :source => "Woo hoo! Your password has been changed!", :target => "Vielen Dank, Ihr Passwort wurde geändert!", :updated_by_id => 1, :created_by_id => 1 )
Translation.create( :locale => 'de', :source => "Please try to login!", :target => "Bitte melden Sie sich nun an!", :updated_by_id => 1, :created_by_id => 1 )
Translation.create( :locale => 'de', :source => "Username or email address invalid, please try again.", :target => "Benutzername oder E-Mail-Addresse ungültig, bitte erneut versuchen.", :updated_by_id => 1, :created_by_id => 1 )
Translation.create( :locale => 'de', :source => "If you don\'t receive instructions within a minute or two, check your email\'s spam and junk filters, or try resending your request.", :target => "Wir hanben die Andorderung per E-Mail an Sie versendet, bitte Überprüfen Sie Ihr Email-Postfach (auch die Junk E-Mails) ggf. starten Sie eine Andorderung erneut.", :updated_by_id => 1, :created_by_id => 1 )
Translation.create( :locale => 'de', :source => "again", :target => "erneut", :updated_by_id => 1, :created_by_id => 1 )
#Translation.create( :locale => 'de', :source => "", :target => "" )
#Translation.create( :locale => 'de', :source => "", :target => "", :updated_by_id => 1, :created_by_id => 1 )