spree_auth 0.30.0.beta1 → 0.30.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of spree_auth might be problematic. Click here for more details.

Files changed (48) hide show
  1. data/README.md +2 -5
  2. data/app/controllers/checkout_controller_decorator.rb +19 -7
  3. data/app/controllers/orders_controller_decorator.rb +8 -4
  4. data/app/controllers/resource_controller_decorator.rb +1 -1
  5. data/app/controllers/spree/base_controller_decorator.rb +24 -3
  6. data/app/controllers/user_sessions_controller.rb +116 -0
  7. data/app/controllers/users_controller.rb +54 -0
  8. data/app/models/ability.rb +24 -1
  9. data/app/models/order_decorator.rb +8 -5
  10. data/app/models/spree_current_order_decorator.rb +8 -0
  11. data/app/models/user.rb +48 -15
  12. data/app/models/user_mailer.rb +12 -0
  13. data/app/models/user_session.rb +3 -0
  14. data/app/views/checkout/registration.html.erb +3 -2
  15. data/app/views/password_resets/edit.html.erb +12 -0
  16. data/app/views/password_resets/new.html.erb +13 -0
  17. data/app/views/shared/_error_messages.html.erb +10 -0
  18. data/app/views/shared/_flashes.html.erb +9 -0
  19. data/app/views/shared/_login_bar.html.erb +4 -4
  20. data/app/views/user_mailer/password_reset_instructions.erb +10 -0
  21. data/app/views/user_sessions/authorization_failure.html.erb +4 -0
  22. data/app/views/user_sessions/new.html.erb +9 -0
  23. data/app/views/users/edit.html.erb +11 -0
  24. data/app/views/users/new.html.erb +23 -0
  25. data/app/views/users/show.html.erb +46 -0
  26. data/config/routes.rb +18 -1
  27. data/db/sample/users.rb +53 -0
  28. data/lib/cancan/controller_additions.rb +60 -0
  29. data/lib/spree/auth_user.rb +5 -9
  30. data/lib/spree_auth.rb +2 -4
  31. data/lib/tasks/auth.rake +8 -0
  32. data/lib/tasks/install.rake +24 -0
  33. metadata +43 -32
  34. data/app/controllers/devise/sessions_controller_decorator.rb +0 -12
  35. data/app/views/devise/confirmations/new.html.erb +0 -12
  36. data/app/views/devise/mailer/confirmation_instructions.html.erb +0 -5
  37. data/app/views/devise/mailer/reset_password_instructions.html.erb +0 -8
  38. data/app/views/devise/mailer/unlock_instructions.html.erb +0 -7
  39. data/app/views/devise/passwords/edit.html.erb +0 -16
  40. data/app/views/devise/passwords/new.html.erb +0 -12
  41. data/app/views/devise/registrations/edit.html.erb +0 -25
  42. data/app/views/devise/registrations/new.html.erb +0 -22
  43. data/app/views/devise/sessions/new.html.erb +0 -20
  44. data/app/views/devise/shared/_links.erb +0 -19
  45. data/app/views/devise/unlocks/new.html.erb +0 -12
  46. data/lib/generators/spree_auth/install_generator.rb +0 -25
  47. data/lib/generators/templates/db/migrate/20100811003924_switch_to_devise.rb +0 -31
  48. data/lib/generators/templates/devise.rb +0 -146
@@ -0,0 +1,46 @@
1
+ <h1><%= t("my_account") %></h1>
2
+
3
+ <%= hook :account_summary do %>
4
+
5
+ <table>
6
+ <tr>
7
+ <td><%= t("email") %>:</td>
8
+ <td>
9
+ <%= @user.email %>
10
+ </td>
11
+ </tr>
12
+ </table>
13
+ <p><%= link_to t('edit'), edit_account_path %></p>
14
+
15
+ <% end %>
16
+
17
+ <%= hook :account_my_orders do %>
18
+
19
+ <h2><%= t("my_orders") %></h2>
20
+
21
+ <table class="order-summary" width="545">
22
+ <thead>
23
+ <tr>
24
+ <th><%= t("order_number") %></th>
25
+ <th><%= t("order_date") %></th>
26
+ <th><%= t("status") %></th>
27
+ <th><%= t("customer") %></th>
28
+ <th><%= t("total") %></th>
29
+ </tr>
30
+ </thead>
31
+ <tbody>
32
+ <% @orders.each do |order| %>
33
+ <tr class="<%= cycle('even', 'odd') %>">
34
+ <td><%= link_to order.number, order_url(order) %></td>
35
+ <td><%=order.created_at.to_date%></td>
36
+ <td><%= t(order.state).titleize %></td>
37
+ <td><%= order.user.email if order.user %></td>
38
+ <td><%= number_to_currency order.total %></td>
39
+ </tr>
40
+ <% end %>
41
+ </tbody>
42
+ </table>
43
+
44
+ <br />
45
+
46
+ <% end %>
data/config/routes.rb CHANGED
@@ -1,4 +1,21 @@
1
1
  Rails.application.routes.draw do
2
+
2
3
  match '/checkout/registration' => 'checkout#registration', :via => :get, :as => :checkout_registration
3
4
  match '/checkout/registration' => 'checkout#update_registration', :via => :put, :as => :update_checkout_registration
4
- end
5
+
6
+ match '/login', :to => 'user_sessions#new', :as => :login
7
+ match '/logout', :to => 'user_sessions#destroy', :as => :logout
8
+ match '/signup', :to => 'users#new', :as => :signup
9
+
10
+ match '/orders/:id/token/:token' => 'orders#show', :via => :get, :as => :token_order
11
+
12
+ resource :user_session do
13
+ member do
14
+ get :nav_bar
15
+ end
16
+ end
17
+ resource :account, :controller => "users"
18
+ resources :password_resets
19
+ resources :users
20
+
21
+ end
@@ -0,0 +1,53 @@
1
+ # see last line where we create an admin if there is none, asking for email and password
2
+ def prompt_for_admin_password
3
+ password = ask('Password [spree123]: ', String) do |q|
4
+ q.echo = false
5
+ q.validate = /^(|.{5,40})$/
6
+ q.responses[:not_valid] = "Invalid password. Must be at least 5 characters long."
7
+ q.whitespace = :strip
8
+ end
9
+ password = "spree123" if password.blank?
10
+ password
11
+ end
12
+
13
+ def prompt_for_admin_email
14
+ email = ask('Email [spree@example.com]: ', String) do |q|
15
+ q.echo = true
16
+ q.whitespace = :strip
17
+ end
18
+ email = "spree@example.com" if email.blank?
19
+ email
20
+ end
21
+
22
+ def create_admin_user
23
+ if ENV['AUTO_ACCEPT']
24
+ password = "spree"
25
+ email = "spree@example.com"
26
+ else
27
+ require 'highline/import'
28
+ puts "Create the admin user (press enter for defaults)."
29
+ #name = prompt_for_admin_name unless name
30
+ email = prompt_for_admin_email
31
+ password = prompt_for_admin_password
32
+ end
33
+ attributes = {
34
+ :password => password,
35
+ :password_confirmation => password,
36
+ :email => email,
37
+ :login => email
38
+ }
39
+
40
+ load 'user.rb'
41
+
42
+ if User.find_by_email(email)
43
+ say "\nWARNING: There is already a user with the email: #{email}, so no account changes were made. If you wish to create an additional admin user, please run rake db:admin:create again with a different email.\n\n"
44
+ else
45
+ admin = User.create(attributes)
46
+ # create an admin role and and assign the admin user to that role
47
+ role = Role.find_or_create_by_name "admin"
48
+ admin.roles << role
49
+ admin.save
50
+ end
51
+ end
52
+
53
+ create_admin_user if User.where("roles.name" => 'admin').includes(:roles).empty?
@@ -0,0 +1,60 @@
1
+ # Overrides the default current_ability method used by Cancan so that we can use the guest_token in addition to current_user.
2
+ # We were having problems layering the custom logic on top of ActionController::Base in certain situations but overriding
3
+ # this file within spree_auth seems to do the trick. Documentation has been stripped (see cancan for the original docs.)
4
+ # Only the current_ability method has been changed.
5
+
6
+ module CanCan
7
+
8
+ module ControllerAdditions
9
+ module ClassMethods
10
+
11
+ def load_and_authorize_resource(*args)
12
+ ControllerResource.add_before_filter(self, :load_and_authorize_resource, *args)
13
+ end
14
+
15
+ def load_resource(*args)
16
+ ControllerResource.add_before_filter(self, :load_resource, *args)
17
+ end
18
+
19
+ def authorize_resource(*args)
20
+ ControllerResource.add_before_filter(self, :authorize_resource, *args)
21
+ end
22
+ end
23
+
24
+ def self.included(base)
25
+ base.extend ClassMethods
26
+ base.helper_method :can?, :cannot?
27
+ end
28
+
29
+ def authorize!(action, subject, *args)
30
+ message = nil
31
+ if args.last.kind_of?(Hash) && args.last.has_key?(:message)
32
+ message = args.pop[:message]
33
+ end
34
+ raise AccessDenied.new(message, action, subject) if cannot?(action, subject, *args)
35
+ end
36
+
37
+ def unauthorized!(message = nil)
38
+ raise ImplementationRemoved, "The unauthorized! method has been removed from CanCan, use authorize! instead."
39
+ end
40
+
41
+ def current_ability
42
+ # HACKED to use Spree's auth_user instead of current_user
43
+ @current_ability ||= ::Ability.new(auth_user)
44
+ end
45
+
46
+ def can?(*args)
47
+ current_ability.can?(*args)
48
+ end
49
+
50
+ def cannot?(*args)
51
+ current_ability.cannot?(*args)
52
+ end
53
+ end
54
+ end
55
+
56
+ if defined? ActionController
57
+ ActionController::Base.class_eval do
58
+ include CanCan::ControllerAdditions
59
+ end
60
+ end
@@ -4,17 +4,13 @@ module Spree
4
4
  # Gives controllers the ability to learn the +auth_user+ as opposed to limiting them to just the standard
5
5
  # +current_user.+ The +auth_user+ method will return the user corresponding to the +guest_token+ if present,
6
6
  # otherwise it will return the +current_user.+ This allows us to check authorization against a guest user
7
- # without requiring that user to be signed in via warden/devise. This means the guest can later sign up for
7
+ # without requiring that user to be signed in. This means the guest can later sign up for
8
8
  # an acccount (or log in to an existing account.)
9
9
  def auth_user
10
- return current_user unless session[:guest_token]
11
- User.find_by_authentication_token(session[:guest_token])
12
- end
13
-
14
- # Overrides the default method used by Cancan so that we can use the guest_token in addition to current_user.
15
- def current_ability
16
- @current_ability ||= ::Ability.new(auth_user)
10
+ return current_user if current_user
11
+ return nil if session[:guest_token].blank?
12
+ User.find_by_persistence_token(session[:guest_token])
17
13
  end
18
14
 
19
15
  end
20
- end
16
+ end
data/lib/spree_auth.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  require 'spree_core'
2
-
3
- require 'devise'
4
- require 'devise/orm/active_record'
2
+ require 'authlogic'
5
3
  require 'cancan'
6
4
 
7
5
  require 'spree/auth_user'
@@ -11,7 +9,7 @@ module SpreeAuth
11
9
  class Engine < Rails::Engine
12
10
  def self.activate
13
11
  Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
14
- Rails.env == "production" ? require(c) : load(c)
12
+ Rails.env.production? ? require(c) : load(c)
15
13
  end
16
14
  end
17
15
  config.to_prepare &method(:activate).to_proc
@@ -0,0 +1,8 @@
1
+ namespace :db do
2
+ namespace :admin do
3
+ desc "Create admin username and password"
4
+ task :create => :environment do
5
+ require File.join(Rails.root, 'db', 'sample', 'users.rb')
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,24 @@
1
+ namespace :spree_auth do
2
+ desc "Copies all migrations and assets (NOTE: This will be obsolete with Rails 3.1)"
3
+ task :install do
4
+ Rake::Task['spree_auth:install:migrations'].invoke
5
+ Rake::Task['spree_auth:install:assets'].invoke
6
+ end
7
+
8
+ namespace :install do
9
+
10
+ desc "Copies all migrations (NOTE: This will be obsolete with Rails 3.1)"
11
+ task :migrations do
12
+ source = File.join(File.dirname(__FILE__), '..', '..', 'db')
13
+ destination = File.join(Rails.root, 'db')
14
+ puts "INFO: Mirroring assets from #{source} to #{destination}"
15
+ Spree::FileUtilz.mirror_files(source, destination)
16
+ end
17
+
18
+ desc "Copies all assets (NOTE: This will be obsolete with Rails 3.1)"
19
+ task :assets do
20
+ # No assets
21
+ end
22
+
23
+ end
24
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_auth
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: true
4
+ hash: 103
5
+ prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 30
8
9
  - 0
9
- - beta1
10
- version: 0.30.0.beta1
10
+ version: 0.30.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sean Schofield
@@ -15,45 +15,50 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-03 00:00:00 -04:00
18
+ date: 2010-11-09 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: spree_core
23
23
  prerelease: false
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
25
26
  requirements:
26
27
  - - "="
27
28
  - !ruby/object:Gem::Version
29
+ hash: 103
28
30
  segments:
29
31
  - 0
30
32
  - 30
31
33
  - 0
32
- - beta1
33
- version: 0.30.0.beta1
34
+ version: 0.30.0
34
35
  type: :runtime
35
36
  version_requirements: *id001
36
37
  - !ruby/object:Gem::Dependency
37
- name: devise
38
+ name: authlogic
38
39
  prerelease: false
39
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
40
42
  requirements:
41
- - - ">="
43
+ - - "="
42
44
  - !ruby/object:Gem::Version
45
+ hash: 7
43
46
  segments:
44
- - 1
45
- - 1
46
47
  - 2
47
- version: 1.1.2
48
+ - 1
49
+ - 6
50
+ version: 2.1.6
48
51
  type: :runtime
49
52
  version_requirements: *id002
50
53
  - !ruby/object:Gem::Dependency
51
54
  name: cancan
52
55
  prerelease: false
53
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
54
58
  requirements:
55
59
  - - ">="
56
60
  - !ruby/object:Gem::Version
61
+ hash: 29
57
62
  segments:
58
63
  - 1
59
64
  - 3
@@ -74,35 +79,39 @@ files:
74
79
  - README.md
75
80
  - app/controllers/admin_controller_decorator.rb
76
81
  - app/controllers/checkout_controller_decorator.rb
77
- - app/controllers/devise/sessions_controller_decorator.rb
78
82
  - app/controllers/orders_controller_decorator.rb
79
83
  - app/controllers/resource_controller_decorator.rb
80
84
  - app/controllers/spree/base_controller_decorator.rb
85
+ - app/controllers/user_sessions_controller.rb
86
+ - app/controllers/users_controller.rb
81
87
  - app/models/ability.rb
82
88
  - app/models/order_decorator.rb
83
89
  - app/models/spree_auth_configuration.rb
90
+ - app/models/spree_current_order_decorator.rb
84
91
  - app/models/user.rb
92
+ - app/models/user_mailer.rb
93
+ - app/models/user_session.rb
85
94
  - app/views/checkout/registration.html.erb
86
- - app/views/devise/confirmations/new.html.erb
87
- - app/views/devise/mailer/confirmation_instructions.html.erb
88
- - app/views/devise/mailer/reset_password_instructions.html.erb
89
- - app/views/devise/mailer/unlock_instructions.html.erb
90
- - app/views/devise/passwords/edit.html.erb
91
- - app/views/devise/passwords/new.html.erb
92
- - app/views/devise/registrations/edit.html.erb
93
- - app/views/devise/registrations/new.html.erb
94
- - app/views/devise/sessions/new.html.erb
95
- - app/views/devise/shared/_links.erb
96
- - app/views/devise/unlocks/new.html.erb
95
+ - app/views/password_resets/edit.html.erb
96
+ - app/views/password_resets/new.html.erb
97
+ - app/views/shared/_error_messages.html.erb
98
+ - app/views/shared/_flashes.html.erb
97
99
  - app/views/shared/_login_bar.html.erb
98
100
  - app/views/shared/unauthorized.html.erb
101
+ - app/views/user_mailer/password_reset_instructions.erb
102
+ - app/views/user_sessions/authorization_failure.html.erb
103
+ - app/views/user_sessions/new.html.erb
104
+ - app/views/users/edit.html.erb
105
+ - app/views/users/new.html.erb
106
+ - app/views/users/show.html.erb
99
107
  - config/routes.rb
100
- - lib/generators/spree_auth/install_generator.rb
101
- - lib/generators/templates/db/migrate/20100811003924_switch_to_devise.rb
102
- - lib/generators/templates/devise.rb
108
+ - lib/cancan/controller_additions.rb
103
109
  - lib/spree/auth/config.rb
104
110
  - lib/spree/auth_user.rb
105
111
  - lib/spree_auth.rb
112
+ - lib/tasks/auth.rake
113
+ - lib/tasks/install.rake
114
+ - db/sample/users.rb
106
115
  has_rdoc: true
107
116
  homepage: http://spreecommerce.com
108
117
  licenses: []
@@ -113,27 +122,29 @@ rdoc_options: []
113
122
  require_paths:
114
123
  - lib
115
124
  required_ruby_version: !ruby/object:Gem::Requirement
125
+ none: false
116
126
  requirements:
117
127
  - - ">="
118
128
  - !ruby/object:Gem::Version
129
+ hash: 57
119
130
  segments:
120
131
  - 1
121
132
  - 8
122
133
  - 7
123
134
  version: 1.8.7
124
135
  required_rubygems_version: !ruby/object:Gem::Requirement
136
+ none: false
125
137
  requirements:
126
- - - ">"
138
+ - - ">="
127
139
  - !ruby/object:Gem::Version
140
+ hash: 3
128
141
  segments:
129
- - 1
130
- - 3
131
- - 1
132
- version: 1.3.1
142
+ - 0
143
+ version: "0"
133
144
  requirements:
134
145
  - none
135
146
  rubyforge_project: spree_auth
136
- rubygems_version: 1.3.6
147
+ rubygems_version: 1.3.7
137
148
  signing_key:
138
149
  specification_version: 3
139
150
  summary: Provides authentication and authorization services for use with Spree.
@@ -1,12 +0,0 @@
1
- Devise::SessionsController.class_eval do
2
- after_filter :associate_user, :only => :create
3
-
4
- include Spree::CurrentOrder
5
- include Spree::AuthUser
6
-
7
- def associate_user
8
- return unless current_user and current_order
9
- current_order.associate_user!(current_user) if can? :edit, current_order
10
- session[:guest_token] = nil
11
- end
12
- end
@@ -1,12 +0,0 @@
1
- <h2><%= t(:resend_confirmation_instructions) %></h2>
2
-
3
- <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
4
- <%= devise_error_messages! %>
5
-
6
- <p><%= f.label :email %><br />
7
- <%= f.text_field :email %></p>
8
-
9
- <p><%= f.submit t(:resend_confirmation_instructions) %></p>
10
- <% end %>
11
-
12
- <%= render :partial => "devise/shared/links" %>
@@ -1,5 +0,0 @@
1
- <p>Welcome <%= @resource.email %>!</p>
2
-
3
- <p>You can confirm your account through the link below:</p>
4
-
5
- <p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
@@ -1,8 +0,0 @@
1
- <p>Hello <%= @resource.email %>!</p>
2
-
3
- <p>Someone has requested a link to change your password, and you can do this through the link below.</p>
4
-
5
- <p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
6
-
7
- <p>If you didn't request this, please ignore this email.</p>
8
- <p>Your password won't change until you access the link above and create a new one.</p>
@@ -1,7 +0,0 @@
1
- <p>Hello <%= @resource.email %>!</p>
2
-
3
- <p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
4
-
5
- <p>Click the link below to unlock your account:</p>
6
-
7
- <p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
@@ -1,16 +0,0 @@
1
- <h2><%= t(:change_my_password) %></h2>
2
-
3
- <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
4
- <%= devise_error_messages! %>
5
- <%= f.hidden_field :reset_password_token %>
6
-
7
- <p><%= f.label :password %><br />
8
- <%= f.password_field :password %></p>
9
-
10
- <p><%= f.label :password_confirmation %><br />
11
- <%= f.password_field :password_confirmation %></p>
12
-
13
- <p><%= f.submit t(:change_my_password) %></p>
14
- <% end %>
15
-
16
- <%= render :partial => "devise/shared/links" %>
@@ -1,12 +0,0 @@
1
- <h2><%= t(:forgot_password) %></h2>
2
-
3
- <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
4
- <%= devise_error_messages! %>
5
-
6
- <p><%= f.label :email %><br />
7
- <%= f.text_field :email %></p>
8
-
9
- <p><%= f.submit t(:send_me_reset_password_instructions) %></p>
10
- <% end %>
11
-
12
- <%= render :partial => "devise/shared/links" %>
@@ -1,25 +0,0 @@
1
- <h2><%= t(:my_account) %></h2>
2
-
3
- <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
4
- <%= devise_error_messages! %>
5
-
6
- <p><%= f.label :email %><br />
7
- <%= f.text_field :email %></p>
8
-
9
- <p><%= f.label :password %> <i><%= t(:leave_blank_to_not_change) %></i><br />
10
- <%= f.password_field :password %></p>
11
-
12
- <p><%= f.label :password_confirmation %><br />
13
- <%= f.password_field :password_confirmation %></p>
14
-
15
- <p><%= f.label :current_password %> <i><%= t(:enter_password_to_confirm) %></i><br />
16
- <%= f.password_field :current_password %></p>
17
-
18
- <p><%= f.submit t(:update) %></p>
19
- <% end %>
20
-
21
- <h3><%= t(:cancel_my_account) %></h3>
22
-
23
- <p><%= t(:cancel_my_account_description) %> <%= link_to t(:cancel_my_account), registration_path(resource_name), :confirm => t(:are_you_sure), :method => :delete %>.</p>
24
-
25
- <%= link_to t(:back), :back %>
@@ -1,22 +0,0 @@
1
- <% @body_id = 'signup' %>
2
-
3
- <div id="new-customer">
4
- <h2><%= t("new_customer") %></h2>
5
-
6
- <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
7
- <%= devise_error_messages! %>
8
-
9
- <p><%= f.label :email %><br />
10
- <%= f.text_field :email %></p>
11
-
12
- <p><%= f.label :password %><br />
13
- <%= f.password_field :password %></p>
14
-
15
- <p><%= f.label :password_confirmation %><br />
16
- <%= f.password_field :password_confirmation %></p>
17
-
18
- <p><%= f.submit t(:sign_up) %></p>
19
- <% end %>
20
-
21
- <%= render :partial => "devise/shared/links" %>
22
- </div>
@@ -1,20 +0,0 @@
1
- <% @body_id = 'login' %>
2
- <div id="existing-customer">
3
- <h2><%= t("login_as_existing") %></h2>
4
-
5
- <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
6
- <p><%= f.label :email %><br />
7
- <%= f.text_field :email %></p>
8
-
9
- <p><%= f.label :password %><br />
10
- <%= f.password_field :password %></p>
11
-
12
- <% if devise_mapping.rememberable? -%>
13
- <p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
14
- <% end -%>
15
-
16
- <p><%= f.submit t(:log_in) %></p>
17
- <% end %>
18
-
19
- <%= render :partial => "devise/shared/links" %>
20
- </div>
@@ -1,19 +0,0 @@
1
- <%- if controller_name != 'sessions' %>
2
- <%= link_to t(:log_in), new_session_path(resource_name) %><br />
3
- <% end -%>
4
-
5
- <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6
- <%= link_to t(:sign_up), new_registration_path(resource_name) %><br />
7
- <% end -%>
8
-
9
- <%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
10
- <%= link_to t(:forgot_password), new_password_path(resource_name) %><br />
11
- <% end -%>
12
-
13
- <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14
- <%= link_to t(:didnt_receive_confirmation_instructions), new_confirmation_path(resource_name) %><br />
15
- <% end -%>
16
-
17
- <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18
- <%= link_to t(:didnt_receive_unlock_instructions), new_unlock_path(resource_name) %><br />
19
- <% end -%>
@@ -1,12 +0,0 @@
1
- <h2><%= t(:resend_unlock_instructions) %></h2>
2
-
3
- <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
4
- <%= devise_error_messages! %>
5
-
6
- <p><%= f.label :email %><br />
7
- <%= f.text_field :email %></p>
8
-
9
- <p><%= f.submit t(:resend_unlock_instructions) %></p>
10
- <% end %>
11
-
12
- <%= render :partial => "devise/shared/links" %>
@@ -1,25 +0,0 @@
1
- module SpreeAuth
2
- module Generators
3
- class InstallGenerator < Rails::Generators::Base
4
- source_root File.expand_path("../../templates", __FILE__)
5
-
6
- desc "Configures your Rails application for use with spree_auth."
7
-
8
- def setup_routes
9
- route 'devise_for :users'
10
- end
11
-
12
- def copy_initializer
13
- template "devise.rb", "config/initializers/devise.rb"
14
- end
15
-
16
- def copy_migrations
17
- directory "db"
18
- end
19
-
20
- # def show_readme
21
- # readme "README" if behavior == :invoke
22
- # end
23
- end
24
- end
25
- end