Fixed login -> reset password -> go back

This commit is contained in:
Martin Edenhofer 2014-07-20 00:24:58 +02:00
parent e6cf28b222
commit 74e548fedb
7 changed files with 32 additions and 42 deletions

View file

@ -20,21 +20,25 @@ class Index extends App.ControllerContent
url: '/auth/facebook', url: '/auth/facebook',
name: 'Facebook', name: 'Facebook',
config: 'auth_facebook', config: 'auth_facebook',
class: 'facebook',
}, },
twitter: { twitter: {
url: '/auth/twitter', url: '/auth/twitter',
name: 'Twitter', name: 'Twitter',
config: 'auth_twitter', config: 'auth_twitter',
class: 'twitter',
}, },
linkedin: { linkedin: {
url: '/auth/linkedin', url: '/auth/linkedin',
name: 'LinkedIn', name: 'LinkedIn',
config: 'auth_linkedin', config: 'auth_linkedin',
class: 'linkedin',
}, },
google_oauth2: { google_oauth2: {
url: '/auth/google_oauth2', url: '/auth/google_oauth2',
name: 'Google', name: 'Google',
config: 'auth_google_oauth2', config: 'auth_google_oauth2',
class: 'google',
}, },
} }
auth_providers = [] auth_providers = []

View file

@ -1,10 +1,8 @@
class Index extends App.ControllerContent class Index extends App.ControllerContent
className: 'reset_password fit'
events: events:
'submit form': 'submit' 'submit form': 'submit'
'click .submit': 'submit' 'click .submit': 'submit'
'click .retry': 'rerender' 'click .retry': 'retry'
constructor: -> constructor: ->
super super
@ -28,14 +26,14 @@ class Index extends App.ControllerContent
@html App.view('password/reset')(params) @html App.view('password/reset')(params)
@form = new App.ControllerForm( @form = new App.ControllerForm(
el: @el.find('#form-password-item') el: @el.find('.form-password-item')
model: { configure_attributes: configure_attributes } model: { configure_attributes: configure_attributes }
autofocus: true autofocus: true
) )
rerender: (e) -> retry: (e) ->
e.preventDefault() e.preventDefault()
@el.find('#form-password').show() @render()
submit: (e) -> submit: (e) ->
e.preventDefault() e.preventDefault()
@ -55,20 +53,17 @@ class Index extends App.ControllerContent
success: (data, status, xhr) => success: (data, status, xhr) =>
@render( sent: true ) @render( sent: true )
@el.find('#form-password').hide()
error: (data, status, xhr) => error: (data, status, xhr) =>
@notify( @notify(
type: 'error' type: 'error'
msg: App.i18n.translateContent( 'Username or email address invalid, please try again.' ) msg: App.i18n.translateContent( 'Username or email address invalid, please try again.' )
) )
@formEnable( @el.find('#form-password') ) @formEnable( @el.find('.form-password') )
App.Config.set( 'reset_password', Index, 'Routes' ) App.Config.set( 'reset_password', Index, 'Routes' )
class Verify extends App.ControllerContent class Verify extends App.ControllerContent
className: 'container'
events: events:
'submit form': 'submit' 'submit form': 'submit'
'click .submit': 'submit' 'click .submit': 'submit'

View file

@ -1,6 +1,4 @@
class Index extends App.ControllerContent class Index extends App.ControllerContent
className: 'signup fit'
events: events:
'submit form': 'submit' 'submit form': 'submit'
'click .submit': 'submit' 'click .submit': 'submit'

View file

@ -18,31 +18,23 @@
<button class="btn btn-primary" type="submit"><%- @T( 'Sign in' ) %></button> <button class="btn btn-primary" type="submit"><%- @T( 'Sign in' ) %></button>
<% if @C('user_lost_password'): %> <% if @C('user_lost_password'): %>
<a href="#reset_password" class="subtle-link standalone pull-right"><%- @T( 'Forgot password?' ) %></a> <a href="#reset_password" class="subtle-link standalone pull-right"><%- @T( 'Forgot password?' ) %></a>
<% end %> <% end %>
</div> </div>
<% if true or !_.isEmpty( @auth_providers ): %> <% if !_.isEmpty( @auth_providers ): %>
<div class="separator"> <div class="separator">
<span class="separator-text"><%- @T( 'or sign in using' ) %></span> <span class="separator-text"><%- @T( 'or sign in using' ) %></span>
</div> </div>
<div class="auth_providers horizontal stretch"> <div class="auth_providers horizontal stretch">
<!--<% for auth_provider in @auth_providers: %> <% for auth_provider in @auth_providers: %>
<li><a href="<%= auth_provider.url %>"><%- @T( auth_provider.name ) %></a></li> <a class="auth_provider <%= auth_provider.class %> horizontal" href="<%= auth_provider.url %>">
<% end %>--> <span class="provider_icon"></span>
<a class="auth_provider facebook horizontal"> <span class="provider_name flex"><%- @T( auth_provider.name ) %></span>
<span class="provider_icon"></span> </a>
<span class="provider_name flex">Facebook</span> <li><a href="<%= auth_provider.url %>"></a></li>
</a> <% end %>
<a class="auth_provider google horizontal">
<span class="provider_icon"></span>
<span class="provider_name flex">Google+</span>
</a>
<a class="auth_provider twitter horizontal">
<span class="provider_icon"></span>
<span class="provider_name flex">Twitter</span>
</a>
</div> </div>
<% end %> <% end %>
</form> </form>
@ -50,14 +42,15 @@
<p> <p>
<%- @T( "You're already registered with your email adress if you've been in touch with our support team.") %><br> <%- @T( "You're already registered with your email adress if you've been in touch with our support team.") %><br>
<%- @T( "You can request your password") %> <a href="#"><%- @T( "here") %></a>. <% if @C('user_lost_password'): %>
<%- @T( "You can request your password") %> <a href="#reset_password"><%- @T( "here") %></a>.
<% end %>
</p> </p>
<% if @C('user_create_account'): %> <% if @C('user_create_account'): %>
<hr> <hr>
<p>
<p> <a href="#signup"><%- @T( 'Register as a new customer' ) %></a>
<a href="#signup"><%- @T( 'Register as a new customer' ) %></a> </p>
</p>
<% end %> <% end %>
</div> </div>

View file

@ -1,18 +1,18 @@
<div class="fullHeight vertical center justified"> <div class="fullHeight vertical center justified reset_password fit">
<div class="hero-unit"> <div class="hero-unit">
<% if @sent: %> <% if @sent: %>
<h2><%- @T('We\'ve sent password reset instructions to your email address.') %><small></small></h2> <h2><%- @T('We\'ve sent password reset instructions to your email address.') %><small></small></h2>
<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> <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="subtle retry">&raquo; <%- @T('again') %> &laquo;</a> <a href="#" class="subtle retry">&raquo; <%- @T('again') %> &laquo;</a>
<% end %> <% else: %>
<div id="form-password">
<h2><%- @T( 'Forgot your password?' ) %><small></small></h2> <h2><%- @T( 'Forgot your password?' ) %><small></small></h2>
<form id="form-password-item"> <form class="form-password">
<div class="form-password-item"></div>
<div class="form-controls"> <div class="form-controls">
<a class="subtle-link standalone pull-left cancel" href="#/"><%- @T( 'Cancel & Go Back' ) %></a> <a class="subtle-link standalone pull-left cancel" href="#/"><%- @T( 'Cancel & Go Back' ) %></a>
<button class="btn btn-primary submit pull-right"><%- @T( 'Submit' ) %></button> <button class="btn btn-primary submit pull-right"><%- @T( 'Submit' ) %></button>
</div> </div>
</form> </form>
</div> <% end %>
</div> </div>
</div> </div>

View file

@ -1,4 +1,4 @@
<div class="fullHeight vertical center justified"> <div class="fullHeight vertical center justified reset_password fit">
<div class="hero-unit"> <div class="hero-unit">
<h2><%- @T( 'Choose your new password.' ) %><small></small></h2> <h2><%- @T( 'Choose your new password.' ) %><small></small></h2>
<form id="form-password-change"> <form id="form-password-change">

View file

@ -1,4 +1,4 @@
<div class="fullHeight vertical center justified"> <div class="fullHeight vertical center justified signup fit">
<div class="hero-unit"> <div class="hero-unit">
<h1><%- @T( 'Join' ) %> <%= @C( 'product_name' ) %></h1> <h1><%- @T( 'Join' ) %> <%= @C( 'product_name' ) %></h1>
<form> <form>