spree_auth 0.30.0.beta1 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of spree_auth might be problematic. Click here for more details.
- data/README.md +2 -5
- data/app/controllers/checkout_controller_decorator.rb +19 -7
- data/app/controllers/orders_controller_decorator.rb +8 -4
- data/app/controllers/resource_controller_decorator.rb +1 -1
- data/app/controllers/spree/base_controller_decorator.rb +24 -3
- data/app/controllers/user_sessions_controller.rb +116 -0
- data/app/controllers/users_controller.rb +54 -0
- data/app/models/ability.rb +24 -1
- data/app/models/order_decorator.rb +8 -5
- data/app/models/spree_current_order_decorator.rb +8 -0
- data/app/models/user.rb +48 -15
- data/app/models/user_mailer.rb +12 -0
- data/app/models/user_session.rb +3 -0
- data/app/views/checkout/registration.html.erb +3 -2
- data/app/views/password_resets/edit.html.erb +12 -0
- data/app/views/password_resets/new.html.erb +13 -0
- data/app/views/shared/_error_messages.html.erb +10 -0
- data/app/views/shared/_flashes.html.erb +9 -0
- data/app/views/shared/_login_bar.html.erb +4 -4
- data/app/views/user_mailer/password_reset_instructions.erb +10 -0
- data/app/views/user_sessions/authorization_failure.html.erb +4 -0
- data/app/views/user_sessions/new.html.erb +9 -0
- data/app/views/users/edit.html.erb +11 -0
- data/app/views/users/new.html.erb +23 -0
- data/app/views/users/show.html.erb +46 -0
- data/config/routes.rb +18 -1
- data/db/sample/users.rb +53 -0
- data/lib/cancan/controller_additions.rb +60 -0
- data/lib/spree/auth_user.rb +5 -9
- data/lib/spree_auth.rb +2 -4
- data/lib/tasks/auth.rake +8 -0
- data/lib/tasks/install.rake +24 -0
- metadata +43 -32
- data/app/controllers/devise/sessions_controller_decorator.rb +0 -12
- data/app/views/devise/confirmations/new.html.erb +0 -12
- data/app/views/devise/mailer/confirmation_instructions.html.erb +0 -5
- data/app/views/devise/mailer/reset_password_instructions.html.erb +0 -8
- data/app/views/devise/mailer/unlock_instructions.html.erb +0 -7
- data/app/views/devise/passwords/edit.html.erb +0 -16
- data/app/views/devise/passwords/new.html.erb +0 -12
- data/app/views/devise/registrations/edit.html.erb +0 -25
- data/app/views/devise/registrations/new.html.erb +0 -22
- data/app/views/devise/sessions/new.html.erb +0 -20
- data/app/views/devise/shared/_links.erb +0 -19
- data/app/views/devise/unlocks/new.html.erb +0 -12
- data/lib/generators/spree_auth/install_generator.rb +0 -25
- data/lib/generators/templates/db/migrate/20100811003924_switch_to_devise.rb +0 -31
- data/lib/generators/templates/devise.rb +0 -146
data/README.md
CHANGED
@@ -18,14 +18,11 @@ Running Tests
|
|
18
18
|
|
19
19
|
You need to do a quick one-time creation of a test application and then you can use it to run the tests.
|
20
20
|
|
21
|
-
|
22
|
-
cd testapp
|
23
|
-
rails g spree_core:install
|
24
|
-
rake db:migrate db:seed db:test:prepare
|
21
|
+
rake test_app
|
25
22
|
|
26
23
|
Then run the tests
|
27
24
|
|
28
|
-
|
25
|
+
rake spec
|
29
26
|
|
30
27
|
Misc
|
31
28
|
----
|
@@ -2,17 +2,20 @@ CheckoutController.class_eval do
|
|
2
2
|
before_filter :check_authorization
|
3
3
|
before_filter :check_registration, :except => [:registration, :update_registration]
|
4
4
|
|
5
|
+
helper :users
|
6
|
+
|
5
7
|
def registration
|
6
8
|
@user = User.new
|
7
9
|
end
|
8
10
|
|
9
11
|
def update_registration
|
10
|
-
|
11
|
-
|
12
|
-
if
|
13
|
-
redirect_to checkout_path
|
12
|
+
# hack - temporarily change the state to something other than cart so we can validate the order email address
|
13
|
+
current_order.state = "address"
|
14
|
+
if current_order.update_attributes(params[:order])
|
15
|
+
redirect_to checkout_path
|
14
16
|
else
|
15
|
-
|
17
|
+
@user = User.new
|
18
|
+
render 'registration'
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
@@ -24,7 +27,16 @@ CheckoutController.class_eval do
|
|
24
27
|
# Introduces a registration step whenever the +registration_step+ preference is true.
|
25
28
|
def check_registration
|
26
29
|
return unless Spree::Auth::Config[:registration_step]
|
27
|
-
return if current_user or
|
30
|
+
return if current_user or current_order.email
|
31
|
+
store_location
|
28
32
|
redirect_to checkout_registration_path
|
29
33
|
end
|
30
|
-
|
34
|
+
|
35
|
+
# Overrides the equivalent method defined in spree_core. This variation of the method will ensure that users
|
36
|
+
# are redirected to the tokenized order url unless authenticated as a registered user.
|
37
|
+
def completion_route
|
38
|
+
return order_path(@order) if current_user
|
39
|
+
token_order_path(@order, @order.user.token)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -3,16 +3,20 @@ OrdersController.class_eval do
|
|
3
3
|
before_filter :check_authorization
|
4
4
|
|
5
5
|
private
|
6
|
+
|
6
7
|
def store_guest
|
7
8
|
return if current_user
|
8
|
-
session[:guest_token] ||= @order.user.
|
9
|
+
session[:guest_token] ||= @order.user.persistence_token
|
9
10
|
end
|
10
11
|
|
11
12
|
def check_authorization
|
12
|
-
|
13
|
-
|
13
|
+
session[:guest_token] ||= params[:token]
|
14
|
+
order = current_order || Order.find_by_number(params[:id])
|
15
|
+
if order
|
16
|
+
authorize! :edit, order
|
14
17
|
else
|
15
18
|
authorize! :create, Order
|
16
19
|
end
|
17
20
|
end
|
18
|
-
|
21
|
+
|
22
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
Spree::BaseController.class_eval do
|
2
|
+
before_filter :check_guest
|
2
3
|
|
3
4
|
include Spree::AuthUser
|
4
5
|
|
@@ -6,6 +7,25 @@ Spree::BaseController.class_eval do
|
|
6
7
|
rescue_from CanCan::AccessDenied, :with => :unauthorized
|
7
8
|
|
8
9
|
private
|
10
|
+
# authorize the user as a guest if the have a valid token
|
11
|
+
def check_guest
|
12
|
+
session[:guest_token] ||= params[:token]
|
13
|
+
end
|
14
|
+
|
15
|
+
def current_user_session
|
16
|
+
return @current_user_session if defined?(@current_user_session)
|
17
|
+
@current_user_session = UserSession.find
|
18
|
+
end
|
19
|
+
|
20
|
+
def current_user
|
21
|
+
return @current_user if defined?(@current_user)
|
22
|
+
@current_user = current_user_session && current_user_session.user
|
23
|
+
end
|
24
|
+
|
25
|
+
helper_method :current_user_session, :current_user
|
26
|
+
|
27
|
+
|
28
|
+
|
9
29
|
|
10
30
|
# Redirect as appropriate when an access request fails. The default action is to redirect to the login screen.
|
11
31
|
# Override this method in your controllers if you want to have special behavior in case the user is not authorized
|
@@ -18,7 +38,7 @@ Spree::BaseController.class_eval do
|
|
18
38
|
render 'shared/unauthorized', :layout => 'spree_application'
|
19
39
|
else
|
20
40
|
store_location
|
21
|
-
redirect_to
|
41
|
+
redirect_to login_path and return
|
22
42
|
end
|
23
43
|
end
|
24
44
|
format.xml do
|
@@ -29,10 +49,11 @@ Spree::BaseController.class_eval do
|
|
29
49
|
|
30
50
|
def store_location
|
31
51
|
# disallow return to login, logout, signup pages
|
32
|
-
disallowed_urls = [
|
52
|
+
disallowed_urls = [signup_url, login_url, logout_url]
|
33
53
|
disallowed_urls.map!{|url| url[/\/\w+$/]}
|
34
54
|
unless disallowed_urls.include?(request.fullpath)
|
35
55
|
session[:return_to] = request.fullpath
|
36
56
|
end
|
37
57
|
end
|
38
|
-
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
class UserSessionsController < Spree::BaseController
|
2
|
+
include Spree::CurrentOrder
|
3
|
+
include Spree::AuthUser
|
4
|
+
|
5
|
+
after_filter :associate_user, :only => :create
|
6
|
+
|
7
|
+
ssl_required :new, :create, :destroy, :update
|
8
|
+
ssl_allowed :login_bar
|
9
|
+
|
10
|
+
def new
|
11
|
+
@user_session = UserSession.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def create
|
15
|
+
create_user_session(params[:user_session])
|
16
|
+
# not_need_user_auto_creation =
|
17
|
+
# user_without_openid(params[:user_session]) ||
|
18
|
+
# user_with_openid_exists?(:openid_identifier => params['openid.identity']) ||
|
19
|
+
# user_with_openid_exists?(params[:user_session])
|
20
|
+
|
21
|
+
# if not_need_user_auto_creation
|
22
|
+
# create_user_session(params[:user_session])
|
23
|
+
# else
|
24
|
+
# create_user(params[:user_session])
|
25
|
+
# end
|
26
|
+
end
|
27
|
+
|
28
|
+
def destroy
|
29
|
+
current_user_session.destroy
|
30
|
+
session.clear
|
31
|
+
flash[:notice] = t("logged_out")
|
32
|
+
redirect_to products_path
|
33
|
+
end
|
34
|
+
|
35
|
+
def nav_bar
|
36
|
+
render :partial => "shared/nav_bar"
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def associate_user
|
42
|
+
return unless current_user and current_order
|
43
|
+
current_order.associate_user!(current_user)
|
44
|
+
session[:guest_token] = nil
|
45
|
+
end
|
46
|
+
|
47
|
+
def user_with_openid_exists?(data)
|
48
|
+
data && !data[:openid_identifier].blank? &&
|
49
|
+
!!User.find(:first, :conditions => ["openid_identifier LIKE ?", "%#{data[:openid_identifier]}%"])
|
50
|
+
end
|
51
|
+
|
52
|
+
def user_without_openid(data)
|
53
|
+
data && data[:openid_identifier].blank?
|
54
|
+
end
|
55
|
+
|
56
|
+
def create_user_session(data)
|
57
|
+
@user_session = UserSession.new(data)
|
58
|
+
@user_session.save do |result|
|
59
|
+
if result
|
60
|
+
# Should restore last uncompleted order and add current(guest) order to it, if exists.
|
61
|
+
order = @user_session.record.orders.last(:conditions => {:completed_at => nil})
|
62
|
+
if order
|
63
|
+
if (session[:order_token] && guest_order = Order.find(:first, :conditions => {:token => session[:order_token], :user_id => nil, :completed_at => nil}))
|
64
|
+
guest_order.line_items.each do |line_item|
|
65
|
+
order.add_variant(line_item.variant, line_item.quantity)
|
66
|
+
end
|
67
|
+
order.save
|
68
|
+
session[:return_to].gsub!(guest_order.number, order.number) if session[:return_to]
|
69
|
+
guest_order.destroy
|
70
|
+
end
|
71
|
+
session[:order_token] = order.token
|
72
|
+
session[:order_id] = order.id
|
73
|
+
end
|
74
|
+
|
75
|
+
respond_to do |format|
|
76
|
+
format.html {
|
77
|
+
flash[:notice] = t("logged_in_succesfully") unless session[:return_to]
|
78
|
+
redirect_back_or_default products_path
|
79
|
+
}
|
80
|
+
format.js {
|
81
|
+
user = @user_session.record
|
82
|
+
render :json => {:ship_address => user.ship_address, :bill_address => user.bill_address}.to_json
|
83
|
+
}
|
84
|
+
end
|
85
|
+
else
|
86
|
+
respond_to do |format|
|
87
|
+
format.html {
|
88
|
+
flash.now[:error] = t("login_failed")
|
89
|
+
render :action => :new
|
90
|
+
}
|
91
|
+
format.js { render :json => false }
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
redirect_back_or_default(products_path) unless performed?
|
96
|
+
end
|
97
|
+
|
98
|
+
def create_user(data)
|
99
|
+
@user = User.new(data)
|
100
|
+
|
101
|
+
@user.save do |result|
|
102
|
+
if result
|
103
|
+
flash[:notice] = t(:user_created_successfully) unless session[:return_to]
|
104
|
+
redirect_back_or_default products_url
|
105
|
+
else
|
106
|
+
flash[:notice] = t(:missing_required_information)
|
107
|
+
redirect_to :controller => :users, :action => :new, :user => {:openid_identifier => @user.openid_identifier}
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def accurate_title
|
113
|
+
I18n.t(:log_in)
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
class UsersController < Spree::BaseController
|
2
|
+
resource_controller
|
3
|
+
|
4
|
+
ssl_required :new, :create, :edit, :update, :show
|
5
|
+
|
6
|
+
actions :all, :except => [:index, :destroy]
|
7
|
+
|
8
|
+
show.before do
|
9
|
+
@orders = @user.orders.complete
|
10
|
+
end
|
11
|
+
|
12
|
+
create.after do
|
13
|
+
create_session
|
14
|
+
associate_user
|
15
|
+
end
|
16
|
+
|
17
|
+
create.flash nil
|
18
|
+
create.wants.html { redirect_back_or_default(root_url) }
|
19
|
+
|
20
|
+
new_action.before do
|
21
|
+
flash.now[:notice] = I18n.t(:please_create_user) unless User.admin_created?
|
22
|
+
end
|
23
|
+
|
24
|
+
update.wants.html { redirect_to account_url }
|
25
|
+
|
26
|
+
update.after do
|
27
|
+
create_session
|
28
|
+
end
|
29
|
+
|
30
|
+
update.flash I18n.t("account_updated")
|
31
|
+
|
32
|
+
private
|
33
|
+
def object
|
34
|
+
@object ||= current_user
|
35
|
+
end
|
36
|
+
|
37
|
+
def accurate_title
|
38
|
+
I18n.t(:account)
|
39
|
+
end
|
40
|
+
|
41
|
+
def associate_user
|
42
|
+
return unless current_order and @user.valid?
|
43
|
+
current_order.associate_user!(@user)
|
44
|
+
session[:guest_token] = nil
|
45
|
+
end
|
46
|
+
|
47
|
+
def create_session
|
48
|
+
session_params = params[:user]
|
49
|
+
session_params[:login] = session_params[:email]
|
50
|
+
UserSession.create session_params
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
data/app/models/ability.rb
CHANGED
@@ -1,12 +1,28 @@
|
|
1
|
+
# Implementation class for Cancan gem. Instead of overriding this class, consider adding new permissions
|
2
|
+
# using the special +register_ability+ method which allows extensions to add their own abilities.
|
3
|
+
#
|
4
|
+
# See http://github.com/ryanb/cancan for more details on cancan.
|
1
5
|
class Ability
|
2
6
|
include CanCan::Ability
|
3
7
|
|
8
|
+
class_inheritable_accessor :abilities
|
9
|
+
self.abilities = Set.new
|
10
|
+
|
11
|
+
# Allows us to go beyond the standard cancan initialize method which makes it difficult for engines to
|
12
|
+
# modify the default +Ability+ of an application. The +ability+ argument must be a class that includes
|
13
|
+
# the +CanCan::Ability+ module. The registered ability should behave properly as a stand-alone class
|
14
|
+
# and therefore should be easy to test in isolation.
|
15
|
+
def self.register_ability(ability)
|
16
|
+
self.abilities.add(ability)
|
17
|
+
end
|
18
|
+
|
4
19
|
def initialize(user)
|
5
20
|
self.clear_aliased_actions
|
6
21
|
|
7
22
|
# override cancan default aliasing (we don't want to differentiate between read and index)
|
8
23
|
alias_action :edit, :to => :update
|
9
24
|
alias_action :new, :to => :create
|
25
|
+
alias_action :new_action, :to => :create
|
10
26
|
alias_action :show, :to => :read
|
11
27
|
|
12
28
|
user ||= User.new
|
@@ -37,5 +53,12 @@ class Ability
|
|
37
53
|
can :index, Taxon
|
38
54
|
#############################
|
39
55
|
end
|
56
|
+
|
57
|
+
#include any abilities registered by extensions, etc.
|
58
|
+
Ability.abilities.each do |clazz|
|
59
|
+
ability = clazz.send(:new, user)
|
60
|
+
@can_definitions = can_definitions + ability.send(:can_definitions)
|
61
|
+
end
|
62
|
+
|
40
63
|
end
|
41
|
-
end
|
64
|
+
end
|
@@ -1,12 +1,15 @@
|
|
1
1
|
Order.class_eval do
|
2
|
+
delegate :token, :to => :user
|
3
|
+
|
2
4
|
# Associates the specified user with the order and destroys any previous association with guest user if
|
3
5
|
# necessary.
|
4
6
|
def associate_user!(user)
|
5
7
|
self.user = user
|
6
|
-
|
8
|
+
self.email = user.email
|
9
|
+
# disable validations since this can cause issues when associating an incomplete address during the address step
|
10
|
+
save(:validate => false)
|
7
11
|
end
|
8
12
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
13
|
+
validates_format_of :email, :with => Authlogic::Regex.email, :if => :require_email
|
14
|
+
|
15
|
+
end
|
data/app/models/user.rb
CHANGED
@@ -6,38 +6,71 @@ class User < ActiveRecord::Base
|
|
6
6
|
belongs_to :bill_address, :foreign_key => "bill_address_id", :class_name => "Address"
|
7
7
|
|
8
8
|
before_save :check_admin
|
9
|
+
before_validation :set_login
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
acts_as_authentic do |c|
|
12
|
+
c.transition_from_restful_authentication = true
|
13
|
+
c.maintain_sessions = false
|
14
|
+
#AuthLogic defaults
|
15
|
+
#c.validate_email_field = true
|
16
|
+
#c.validates_length_of_email_field_options = {:within => 6..100}
|
17
|
+
#c.validates_format_of_email_field_options = {:with => email_regex, :message => I18n.t(‘error_messages.email_invalid’, :default => “should look like an email address.”)}
|
18
|
+
#c.validate_password_field = true
|
19
|
+
#c.validates_length_of_password_field_options = {:minimum => 4, :if => :require_password?}
|
20
|
+
#for more defaults check the AuthLogic documentation
|
21
|
+
end
|
14
22
|
|
15
23
|
# Setup accessible (or protected) attributes for your model
|
16
|
-
attr_accessible :email, :password, :password_confirmation, :remember_me
|
17
|
-
after_save :ensure_authentication_token!
|
24
|
+
attr_accessible :email, :password, :password_confirmation, :remember_me
|
18
25
|
|
19
|
-
alias_attribute :token, :
|
26
|
+
alias_attribute :token, :persistence_token
|
20
27
|
|
21
28
|
# has_role? simply needs to return true or false whether a user has a role or not.
|
22
29
|
def has_role?(role_in_question)
|
23
30
|
roles.any? { |role| role.name == role_in_question.to_s }
|
24
31
|
end
|
25
32
|
|
33
|
+
# Creates an anonymous user. An anonymous user is basically an auto-generated +User+ account that is created for the customer
|
34
|
+
# behind the scenes and its completely transparently to the customer. All +Orders+ must have a +User+ so this is necessary
|
35
|
+
# when adding to the "cart" (which is really an order) and before the customer has a chance to provide an email or to register.
|
26
36
|
def self.anonymous!
|
27
|
-
token = User.generate_token(:
|
28
|
-
User.create(:email => "#{token}@example.
|
37
|
+
token = User.generate_token(:persistence_token)
|
38
|
+
User.create(:email => "#{token}@example.net", :password => token, :password_confirmation => token)
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.admin_created?
|
42
|
+
Role.where(:name => "admin").includes(:users).count > 0
|
29
43
|
end
|
30
44
|
|
31
|
-
def
|
32
|
-
|
33
|
-
|
45
|
+
def deliver_password_reset_instructions!
|
46
|
+
reset_perishable_token!
|
47
|
+
UserMailer.password_reset_instructions(self).deliver
|
34
48
|
end
|
35
49
|
|
36
50
|
private
|
51
|
+
|
37
52
|
def check_admin
|
38
|
-
if
|
39
|
-
|
53
|
+
return if self.class.admin_created?
|
54
|
+
admin_role = Role.find_or_create_by_name "admin"
|
55
|
+
self.roles << admin_role
|
56
|
+
end
|
57
|
+
|
58
|
+
def set_login
|
59
|
+
# for now force login to be same as email, eventually we will make this configurable, etc.
|
60
|
+
self.login ||= self.email if self.email
|
61
|
+
end
|
62
|
+
|
63
|
+
# Generate a friendly string randomically to be used as token.
|
64
|
+
def self.friendly_token
|
65
|
+
ActiveSupport::SecureRandom.base64(15).tr('+/=', '-_ ').strip.delete("\n")
|
66
|
+
end
|
67
|
+
|
68
|
+
# Generate a token by looping and ensuring does not already exist.
|
69
|
+
def self.generate_token(column)
|
70
|
+
loop do
|
71
|
+
token = friendly_token
|
72
|
+
break token unless find(:first, :conditions => { column => token })
|
40
73
|
end
|
41
|
-
true
|
42
74
|
end
|
75
|
+
|
43
76
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class UserMailer < ActionMailer::Base
|
2
|
+
default_url_options[:host] = Spree::Config[:site_url]
|
3
|
+
default :from => Spree::Config[:mails_from]
|
4
|
+
|
5
|
+
def password_reset_instructions(user)
|
6
|
+
@edit_password_reset_url = edit_password_reset_url(user.perishable_token)
|
7
|
+
mail(:to => user.email,
|
8
|
+
:subject => Spree::Config[:site_name] + ' ' + I18n.t("password_reset_instructions"))
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
@@ -2,12 +2,13 @@
|
|
2
2
|
<h2><%= t("registration")%></h2>
|
3
3
|
<div id="registration">
|
4
4
|
<div id="account">
|
5
|
-
|
5
|
+
<%= render :file => 'users/new' %>
|
6
6
|
</div>
|
7
7
|
<% if Spree::Config[:allow_guest_checkout] %>
|
8
8
|
<div id="guest_checkout">
|
9
|
+
<%= render "shared/error_messages", :target => @order %>
|
9
10
|
<h2><%= t(:guest_user_account) %></h2>
|
10
|
-
<%= form_for
|
11
|
+
<%= form_for @order, :url => update_checkout_registration_path, :html => { :method => :put, :id => "checkout_form_registration"} do |f| %>
|
11
12
|
<p>
|
12
13
|
<%= f.label :email, t("email") %><br />
|
13
14
|
<%= f.text_field :email, :class => 'title' %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<h1><%= t(:change_my_password) %></h1>
|
2
|
+
|
3
|
+
<%= form_for @user, :url => password_reset_path, :method => :put do |f| %>
|
4
|
+
<%= f.error_messages %>
|
5
|
+
<%= f.label :password %><br />
|
6
|
+
<%= f.password_field :password %><br />
|
7
|
+
<br />
|
8
|
+
<%= f.label :password_confirmation %><br />
|
9
|
+
<%= f.password_field :password_confirmation %><br />
|
10
|
+
<br />
|
11
|
+
<%= f.submit t("update_password") %>
|
12
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<h1><%= t(:forgot_password) %></h1>
|
2
|
+
|
3
|
+
<p><%= t(:instructions_to_reset_password) %></p>
|
4
|
+
|
5
|
+
<%= form_tag password_resets_path do %>
|
6
|
+
<p>
|
7
|
+
<label><%= t(:email) %>:</label><br />
|
8
|
+
<%= text_field_tag "email", params[:email], :size => 30 %>
|
9
|
+
</p>
|
10
|
+
<p>
|
11
|
+
<%= submit_tag t("reset_password") %>
|
12
|
+
</p>
|
13
|
+
<% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% if target.errors.any? %>
|
2
|
+
<div id="errorExplanation">
|
3
|
+
<h2><%= pluralize(target.errors.count, "error") %> prohibited this record from being saved:</h2>
|
4
|
+
<ul>
|
5
|
+
<% target.errors.full_messages.each do |msg| %>
|
6
|
+
<li><%= msg %></li>
|
7
|
+
<% end %>
|
8
|
+
</ul>
|
9
|
+
</div>
|
10
|
+
<% end %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% if current_user %>
|
2
|
-
<li><%= link_to t('my_account'),
|
3
|
-
<li><%= link_to t('logout'),
|
2
|
+
<li><%= link_to t('my_account'), account_path %></li>
|
3
|
+
<li><%= link_to t('logout'), logout_path %></li>
|
4
4
|
<% else %>
|
5
|
-
<li><%= link_to t('log_in'),
|
6
|
-
<% end %>
|
5
|
+
<li><%= link_to t('log_in'), login_path %></li>
|
6
|
+
<% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
A request to reset your password has been made.
|
2
|
+
If you did not make this request, simply ignore this email.
|
3
|
+
|
4
|
+
If you did make this request just click the link below:
|
5
|
+
|
6
|
+
<%= @edit_password_reset_url %>
|
7
|
+
|
8
|
+
If the above URL does not work try copying and pasting it into your browser.
|
9
|
+
If you continue to have problem please feel free to contact us.
|
10
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<% @body_id = 'login' %>
|
2
|
+
<div id="existing-customer">
|
3
|
+
<h2><%= t("login_as_existing") %></h2>
|
4
|
+
<%= hook :login do %>
|
5
|
+
<%= render :partial => 'shared/login' %>
|
6
|
+
<%= t("or") %> <%= link_to t("create_a_new_account"), signup_path %> | <%= link_to t("forgot_password"), new_password_reset_path %>
|
7
|
+
<% end %>
|
8
|
+
</div>
|
9
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= render "shared/error_messages", :target => @user %>
|
2
|
+
|
3
|
+
<h1><%= t("editing_user") %></h1>
|
4
|
+
|
5
|
+
<% form_for(:user, :url => object_url, :html => { :method => :put }) do |f| %>
|
6
|
+
<%= render 'shared/user_form', :f => f %>
|
7
|
+
<p>
|
8
|
+
<%=submit_tag t("update") %>
|
9
|
+
</p>
|
10
|
+
<% end %>
|
11
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<% @body_id = 'signup' %>
|
2
|
+
|
3
|
+
<%= render "shared/error_messages", :target => @user %>
|
4
|
+
|
5
|
+
<div id="new-customer">
|
6
|
+
<h2><%= t("new_customer") %></h2>
|
7
|
+
|
8
|
+
<%= hook :signup do %>
|
9
|
+
|
10
|
+
<%= form_for(@user) do |f| %>
|
11
|
+
|
12
|
+
<%= hook :signup_inside_form do %>
|
13
|
+
<%= render 'shared/user_form', :f => f %>
|
14
|
+
<p><%= submit_tag t("create"), :class => 'button primary' %></p>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<% end %>
|
18
|
+
<%= t("or") %> <%= link_to t("login_as_existing"), login_path %>
|
19
|
+
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
</div>
|
23
|
+
|