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.
- data/app/controllers/spree/checkout_controller_decorator.rb +1 -0
- data/app/controllers/spree/user_registrations_controller.rb +1 -1
- data/app/overrides/auth_shared_login_bar.rb +1 -1
- data/app/views/spree/checkout/registration.html.erb +3 -3
- data/app/views/spree/shared/_login_bar.html.erb +1 -1
- data/app/views/spree/user_passwords/new.html.erb +13 -11
- data/app/views/spree/user_registrations/new.html.erb +1 -1
- data/app/views/spree/user_sessions/new.html.erb +1 -1
- data/app/views/spree/users/show.html.erb +4 -5
- data/db/default/users.rb +22 -10
- metadata +9 -11
- data/app/controllers/resource_controller_decorator.rb +0 -25
- data/app/controllers/spree/admin/admin_resource_controller_decorator.rb +0 -3
@@ -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,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
|
-
<
|
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
|
-
<
|
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
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
<% @body_id = 'login' %>
|
6
6
|
<div id="existing-customer">
|
7
|
-
<
|
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
|
-
<
|
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
|
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
|
-
<
|
12
|
+
<h3><%= t(:my_orders) %></h3>
|
14
13
|
<% if @orders.present? %>
|
15
|
-
<table class="order-summary"
|
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
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
17
|
+
|
12
18
|
password
|
13
19
|
end
|
14
20
|
|
15
21
|
def prompt_for_admin_email
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
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.
|
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-
|
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: &
|
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.
|
21
|
+
version: 1.0.0.rc3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70156358869740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: devise
|
27
|
-
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: *
|
35
|
+
version_requirements: *70156358868540
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: cancan
|
38
|
-
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: *
|
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
|