spree_auth 1.0.0.rc2 → 1.0.0.rc3

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.

@@ -9,6 +9,7 @@ Spree::CheckoutController.class_eval do
9
9
  end
10
10
 
11
11
  def update_registration
12
+ fire_event("spree.user.signup", :order => current_order)
12
13
  # hack - temporarily change the state to something other than cart so we can validate the order email address
13
14
  current_order.state = 'address'
14
15
  if current_order.update_attributes(params[:order])
@@ -15,9 +15,9 @@ class Spree::UserRegistrationsController < Devise::RegistrationsController
15
15
  # POST /resource/sign_up
16
16
  def create
17
17
  @user = build_resource(params[:user])
18
- logger.debug(@user)
19
18
  if resource.save
20
19
  set_flash_message(:notice, :signed_up)
20
+ sign_in(:user, @user)
21
21
  fire_event('spree.user.signup', :user => @user)
22
22
  sign_in_and_redirect(:user, @user)
23
23
  else
@@ -1,6 +1,6 @@
1
1
  Deface::Override.new(:virtual_path => "spree/shared/_nav_bar",
2
2
  :name => "auth_shared_login_bar",
3
- :insert_after => "li#search-bar",
3
+ :insert_before => "li#search-bar",
4
4
  :partial => "spree/shared/login_bar",
5
5
  :disabled => false)
6
6
 
@@ -1,13 +1,13 @@
1
1
  <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @user } %>
2
2
  <h2><%= t(:registration) %></h2>
3
3
  <div id="registration">
4
- <div id="account">
4
+ <div id="account" class="columns alpha eight">
5
5
  <%= render :file => 'spree/user_sessions/new' %>
6
6
  </div>
7
7
  <% if Spree::Config[:allow_guest_checkout] %>
8
- <div id="guest_checkout">
8
+ <div id="guest_checkout" class="columns omega eight">
9
9
  <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @order } %>
10
- <h2><%= t(:guest_user_account) %></h2>
10
+ <h6><%= t(:guest_user_account) %></h6>
11
11
  <%= form_for @order, :url => spree.update_checkout_registration_path, :method => :put, :html => { :id => 'checkout_form_registration' } do |f| %>
12
12
  <p>
13
13
  <%= f.label :email, t(:email) %><br />
@@ -2,5 +2,5 @@
2
2
  <li><%= link_to t(:my_account), spree.account_path %></li>
3
3
  <li><%= link_to t(:logout), spree.destroy_user_session_path %></li>
4
4
  <% else %>
5
- <li><%= link_to t(:login), spree.login_path %></li>
5
+ <li id="link-to-login"><%= link_to t(:login), spree.login_path %></li>
6
6
  <% end %>
@@ -1,13 +1,15 @@
1
- <h2><%= t(:forgot_password) %></h2>
1
+ <div id="forgot-password">
2
+ <h6><%= t(:forgot_password) %></h6>
2
3
 
3
- <p><%= t(:instructions_to_reset_password) %></p>
4
+ <p><%= t(:instructions_to_reset_password) %></p>
4
5
 
5
- <%= form_for Spree::User.new, :as => :user, :url => spree.user_password_path do |f| %>
6
- <p>
7
- <%= f.label :email, t(:email) %><br />
8
- <%= f.email_field :email %>
9
- </p>
10
- <p>
11
- <%= f.submit t(:reset_password), :class => 'button primary' %>
12
- </p>
13
- <% end %>
6
+ <%= form_for Spree::User.new, :as => :user, :url => spree.user_password_path do |f| %>
7
+ <p>
8
+ <%= f.label :email, t(:email) %><br />
9
+ <%= f.email_field :email %>
10
+ </p>
11
+ <p>
12
+ <%= f.submit t(:reset_password), :class => 'button primary' %>
13
+ </p>
14
+ <% end %>
15
+ </div>
@@ -3,7 +3,7 @@
3
3
  <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @user } %>
4
4
 
5
5
  <div id="new-customer">
6
- <h2><%= t(:new_customer) %></h2>
6
+ <h6><%= t(:new_customer) %></h6>
7
7
 
8
8
  <div data-hook="signup">
9
9
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  <% @body_id = 'login' %>
6
6
  <div id="existing-customer">
7
- <h2><%= t(:login_as_existing) %></h2>
7
+ <h6><%= t(:login_as_existing) %></h6>
8
8
  <div data-hook="login">
9
9
  <%= render :partial => 'spree/shared/login' %>
10
10
  <%= t(:or) %> <%= link_to t(:create_a_new_account), spree.signup_path %> | <%= link_to t(:forgot_password), spree.new_user_password_path %>
@@ -1,18 +1,17 @@
1
- <h1><%= accurate_title %></h1>
1
+ <h3><%= accurate_title %></h3>
2
2
 
3
3
  <div data-hook="account_summary">
4
4
  <dl id="user-info">
5
5
  <dt><%= t(:email) %></dt>
6
- <dd><%= @user.email %></dd>
6
+ <dd><%= @user.email %> (<%= link_to t(:edit), spree.edit_account_path %>)</dd>
7
7
  </dl>
8
- <p><%= link_to t(:edit), spree.edit_account_path %></p>
9
8
  </div>
10
9
 
11
10
  <div data-hook="account_my_orders">
12
11
 
13
- <h2><%= t(:my_orders) %></h2>
12
+ <h3><%= t(:my_orders) %></h3>
14
13
  <% if @orders.present? %>
15
- <table class="order-summary" style="width:545px;">
14
+ <table class="order-summary">
16
15
  <thead>
17
16
  <tr>
18
17
  <th><%= t(:order_number) %></th>
data/db/default/users.rb CHANGED
@@ -2,22 +2,34 @@ require 'highline/import'
2
2
 
3
3
  # see last line where we create an admin if there is none, asking for email and password
4
4
  def prompt_for_admin_password
5
- password = ask('Password [spree123]: ') do |q|
6
- q.echo = false
7
- q.validate = /^(|.{5,40})$/
8
- q.responses[:not_valid] = 'Invalid password. Must be at least 5 characters long.'
9
- q.whitespace = :strip
5
+ if ENV['ADMIN_PASSWORD']
6
+ password = ENV['ADMIN_PASSWORD'].dup
7
+ say "Admin Password #{password}"
8
+ else
9
+ password = ask('Password [spree123]: ') do |q|
10
+ q.echo = false
11
+ q.validate = /^(|.{5,40})$/
12
+ q.responses[:not_valid] = 'Invalid password. Must be at least 5 characters long.'
13
+ q.whitespace = :strip
14
+ end
15
+ password = 'spree123' if password.blank?
10
16
  end
11
- password = 'spree123' if password.blank?
17
+
12
18
  password
13
19
  end
14
20
 
15
21
  def prompt_for_admin_email
16
- email = ask('Email [spree@example.com]: ') do |q|
17
- q.echo = true
18
- q.whitespace = :strip
22
+ if ENV['ADMIN_EMAIL']
23
+ email = ENV['ADMIN_EMAIL'].dup
24
+ say "Admin User #{email}"
25
+ else
26
+ email = ask('Email [spree@example.com]: ') do |q|
27
+ q.echo = true
28
+ q.whitespace = :strip
29
+ end
30
+ email = 'spree@example.com' if email.blank?
19
31
  end
20
- email = 'spree@example.com' if email.blank?
32
+
21
33
  email
22
34
  end
23
35
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc2
4
+ version: 1.0.0.rc3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-14 00:00:00.000000000Z
12
+ date: 2012-01-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree_core
16
- requirement: &70296291622140 !ruby/object:Gem::Requirement
16
+ requirement: &70156358869740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - =
20
20
  - !ruby/object:Gem::Version
21
- version: 1.0.0.rc2
21
+ version: 1.0.0.rc3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70296291622140
24
+ version_requirements: *70156358869740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: devise
27
- requirement: &70296291621540 !ruby/object:Gem::Requirement
27
+ requirement: &70156358868540 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - =
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.4.8
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70296291621540
35
+ version_requirements: *70156358868540
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: cancan
38
- requirement: &70296291621000 !ruby/object:Gem::Requirement
38
+ requirement: &70156358867500 !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: *70296291621000
46
+ version_requirements: *70156358867500
47
47
  description: Required dependency for Spree
48
48
  email: sean@spreecommerce.com
49
49
  executables: []
@@ -56,10 +56,8 @@ files:
56
56
  - app/assets/javascripts/store/spree_auth.js
57
57
  - app/assets/stylesheets/admin/spree_auth.css
58
58
  - app/assets/stylesheets/store/spree_auth.css
59
- - app/controllers/resource_controller_decorator.rb
60
59
  - app/controllers/spree/admin/admin_controller_decorator.rb
61
60
  - app/controllers/spree/admin/admin_orders_controller_decorator.rb
62
- - app/controllers/spree/admin/admin_resource_controller_decorator.rb
63
61
  - app/controllers/spree/base_controller_decorator.rb
64
62
  - app/controllers/spree/checkout_controller_decorator.rb
65
63
  - app/controllers/spree/orders_controller_decorator.rb
@@ -1,25 +0,0 @@
1
- # This overrides the before method provided by resource_controller so that the current_user is authorized
2
- # for each action before proceding.
3
- module ResourceController
4
- module Helpers
5
- module Internal
6
- protected
7
- # Calls the before block for the action, if one is present.
8
- def before(action)
9
-
10
- resource = case action
11
- when :index, :new, :create
12
- model
13
- else object
14
- end
15
-
16
- if resource.respond_to? :token
17
- authorize! action, resource, session[:access_token]
18
- else
19
- authorize! action, resource
20
- end
21
- invoke_callbacks *self.class.send(action).before
22
- end
23
- end
24
- end
25
- end
@@ -1,3 +0,0 @@
1
- Spree::Admin::ResourceController.class_eval do
2
- authorize_resource :class => lambda { model_class }
3
- end