spree_auth 1.1.1 → 1.1.2.rc1

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.

@@ -1,5 +1,6 @@
1
1
  Spree::BaseController.class_eval do
2
2
  before_filter :set_current_user
3
+ before_filter :set_current_order
3
4
 
4
5
  # graceful error handling for cancan authorization exceptions
5
6
  rescue_from CanCan::AccessDenied do |exception|
@@ -46,4 +47,17 @@ Spree::BaseController.class_eval do
46
47
  def set_current_user
47
48
  Spree::User.current = current_user
48
49
  end
50
+
51
+ def set_current_order
52
+ if current_user
53
+ if current_user.respond_to?(:last_incomplete_order)
54
+ last_incomplete_order = current_user.last_incomplete_order
55
+ if session[:order_id].nil? && last_incomplete_order
56
+ session[:order_id] = last_incomplete_order.id
57
+ elsif current_order && last_incomplete_order && current_order != last_incomplete_order
58
+ current_order.merge!(last_incomplete_order)
59
+ end
60
+ end
61
+ end
62
+ end
49
63
  end
@@ -6,7 +6,7 @@ Spree::ProductsController.class_eval do
6
6
  @product = Spree::Product.find_by_permalink!(params[:id])
7
7
  if !@product.deleted? && (@product.available_on.nil? || @product.available_on.future?)
8
8
  # Allow admins to view any yet to be available products
9
- raise CanCan::AccessDenied unless current_user && current_user.admin?
9
+ raise CanCan::AccessDenied unless current_user && current_user.has_role?("admin")
10
10
  end
11
11
  end
12
12
  end
@@ -9,11 +9,6 @@ class Spree::UserSessionsController < Devise::SessionsController
9
9
  ssl_required :new, :create, :destroy, :update
10
10
  ssl_allowed :login_bar
11
11
 
12
- # GET /resource/sign_in
13
- def new
14
- super
15
- end
16
-
17
12
  def create
18
13
  authenticate_user!
19
14
 
@@ -34,12 +29,6 @@ class Spree::UserSessionsController < Devise::SessionsController
34
29
  end
35
30
  end
36
31
 
37
- def destroy
38
- cookies.clear
39
- session.clear
40
- super
41
- end
42
-
43
32
  def nav_bar
44
33
  render :partial => 'spree/shared/nav_bar'
45
34
  end
@@ -51,6 +51,10 @@ module Spree
51
51
  UserMailer.reset_password_instructions(self).deliver
52
52
  end
53
53
 
54
+ def last_incomplete_order
55
+ orders.incomplete.order("created_at desc").last
56
+ end
57
+
54
58
  protected
55
59
  def password_required?
56
60
  !persisted? || password.present? || password_confirmation.present?
@@ -2,7 +2,7 @@
2
2
  <ul id="login-nav">
3
3
  <li><%= t(:logged_in_as) %>: <%= current_user.email %></li>
4
4
  <li><%= link_to t(:account), spree.edit_user_path(current_user) %></li>
5
- <li><%= link_to t(:logout), spree.destroy_user_session_path %></li>
5
+ <li><%= link_to t(:logout), spree.destroy_user_session_path, :method => :delete %></li>
6
6
  <li><%= link_to t(:store), spree.products_path %></li>
7
7
  </ul>
8
8
  <% end %>
@@ -1,6 +1,6 @@
1
1
  <% if current_user %>
2
2
  <li><%= link_to t(:my_account), spree.account_path %></li>
3
- <li><%= link_to t(:logout), spree.destroy_user_session_path %></li>
3
+ <li><%= link_to t(:logout), spree.destroy_user_session_path, :method => :delete %></li>
4
4
  <% else %>
5
5
  <li id="link-to-login"><%= link_to t(:login), spree.login_path %></li>
6
6
  <% end %>
@@ -138,4 +138,6 @@ Devise.setup do |config|
138
138
  # Don't put a too small interval or your users won't have the time to
139
139
  # change their passwords.
140
140
  config.reset_password_within = 6.hours
141
+
142
+ config.sign_out_via = :delete
141
143
  end
metadata CHANGED
@@ -1,30 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
5
- prerelease:
4
+ version: 1.1.2.rc1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Sean Schofield
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-16 00:00:00.000000000 Z
12
+ date: 2012-06-25 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree_core
16
- requirement: &70261468871880 !ruby/object:Gem::Requirement
16
+ requirement: &70283083574620 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - =
20
20
  - !ruby/object:Gem::Version
21
- version: 1.1.1
21
+ version: 1.1.2.rc1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70261468871880
24
+ version_requirements: *70283083574620
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: devise
27
- requirement: &70261468871080 !ruby/object:Gem::Requirement
27
+ requirement: &70283083574160 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.0.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70261468871080
35
+ version_requirements: *70283083574160
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: cancan
38
- requirement: &70261468870180 !ruby/object:Gem::Requirement
38
+ requirement: &70283083573700 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - =
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 1.6.7
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70261468870180
46
+ version_requirements: *70283083573700
47
47
  description: Required dependency for Spree
48
48
  email: sean@spreecommerce.com
49
49
  executables: []
@@ -129,12 +129,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
129
  required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  none: false
131
131
  requirements:
132
- - - ! '>='
132
+ - - ! '>'
133
133
  - !ruby/object:Gem::Version
134
- version: '0'
135
- segments:
136
- - 0
137
- hash: 2326672717691546910
134
+ version: 1.3.1
138
135
  requirements:
139
136
  - none
140
137
  rubyforge_project: