spree_auth_devise 1.0.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_devise might be problematic. Click here for more details.
- data/LICENSE +26 -0
- data/README.md +39 -0
- data/app/assets/javascripts/admin/spree_auth.js +1 -0
- data/app/assets/javascripts/store/spree_auth.js +1 -0
- data/app/assets/stylesheets/admin/spree_auth.css +3 -0
- data/app/assets/stylesheets/store/spree_auth.css +3 -0
- data/app/controllers/spree/admin/admin_controller_decorator.rb +7 -0
- data/app/controllers/spree/admin/admin_orders_controller_decorator.rb +14 -0
- data/app/controllers/spree/admin/admin_resource_controller_decorator.rb +3 -0
- data/app/controllers/spree/admin/admin_users_controller_decorator.rb +21 -0
- data/app/controllers/spree/admin/users_controller.rb +77 -0
- data/app/controllers/spree/base_controller_decorator.rb +18 -0
- data/app/controllers/spree/checkout_controller_decorator.rb +47 -0
- data/app/controllers/spree/orders_controller_decorator.rb +15 -0
- data/app/controllers/spree/products_controller_decorator.rb +13 -0
- data/app/controllers/spree/user_passwords_controller.rb +32 -0
- data/app/controllers/spree/user_registrations_controller.rb +63 -0
- data/app/controllers/spree/user_sessions_controller.rb +58 -0
- data/app/controllers/spree/users_controller.rb +50 -0
- data/app/helpers/spree/admin/users_helper.rb +10 -0
- data/app/helpers/spree/users_helper.rb +15 -0
- data/app/mailers/spree/user_mailer.rb +8 -0
- data/app/models/spree/auth_configuration.rb +6 -0
- data/app/models/spree/current_order_decorator.rb +12 -0
- data/app/models/spree/user.rb +83 -0
- data/app/overrides/admin_tab.rb +6 -0
- data/app/overrides/auth_admin_login_navigation_bar.rb +5 -0
- data/app/overrides/auth_admin_user_roles.rb +6 -0
- data/app/overrides/auth_shared_login_bar.rb +7 -0
- data/app/overrides/auth_user_login_form.rb +6 -0
- data/app/views/spree/admin/users/_form.html.erb +19 -0
- data/app/views/spree/admin/users/_roles.html.erb +12 -0
- data/app/views/spree/admin/users/edit.html.erb +14 -0
- data/app/views/spree/admin/users/index.html.erb +48 -0
- data/app/views/spree/admin/users/new.html.erb +14 -0
- data/app/views/spree/admin/users/show.html.erb +21 -0
- data/app/views/spree/layouts/admin/_login_nav.html.erb +8 -0
- data/app/views/spree/shared/_flashes.html.erb +9 -0
- data/app/views/spree/shared/_login.html.erb +20 -0
- data/app/views/spree/shared/_login_bar.html.erb +6 -0
- data/app/views/spree/shared/_user_form.html.erb +17 -0
- data/app/views/spree/user_mailer/reset_password_instructions.text.erb +10 -0
- data/app/views/spree/user_passwords/edit.html.erb +15 -0
- data/app/views/spree/user_passwords/new.html.erb +15 -0
- data/app/views/spree/user_registrations/new.html.erb +22 -0
- data/app/views/spree/user_sessions/authorization_failure.html.erb +4 -0
- data/app/views/spree/user_sessions/new.html.erb +13 -0
- data/app/views/spree/users/edit.html.erb +11 -0
- data/app/views/spree/users/show.html.erb +43 -0
- data/config/initializers/devise.rb +142 -0
- data/config/initializers/spree.rb +1 -0
- data/config/locales/en.yml +46 -0
- data/config/routes.rb +31 -0
- data/db/default/users.rb +76 -0
- data/db/migrate/20101026184949_create_users.rb +29 -0
- data/db/migrate/20101026184950_rename_columns_for_devise.rb +37 -0
- data/db/migrate/20101214150824_convert_user_remember_field.rb +11 -0
- data/db/migrate/20120203010234_add_reset_password_sent_at_to_spree_users.rb +8 -0
- data/db/migrate/20120605211305_make_users_email_index_unique.rb +9 -0
- data/db/seeds.rb +5 -0
- data/lib/spree/auth/devise.rb +13 -0
- data/lib/spree/auth/engine.rb +22 -0
- data/lib/spree/auth.rb +1 -0
- data/lib/spree/authentication_helpers.rb +26 -0
- data/lib/spree_auth_devise.rb +2 -0
- data/lib/tasks/auth.rake +9 -0
- metadata +160 -0
@@ -0,0 +1,6 @@
|
|
1
|
+
Deface::Override.new(:virtual_path => "spree/admin/users/_form",
|
2
|
+
:name => "auth_admin_user_roles",
|
3
|
+
:insert_after => "[data-hook='admin_user_form_fields']",
|
4
|
+
:partial => "spree/admin/users/roles",
|
5
|
+
:disabled => false,
|
6
|
+
:original => '0e121156115799a53f5c5dddfb65c1ec80cb5f09')
|
@@ -0,0 +1,6 @@
|
|
1
|
+
Deface::Override.new(:virtual_path => "spree/checkout/registration",
|
2
|
+
:name => "auth_user_login_form",
|
3
|
+
:replace_contents => "[data-hook='registration'] #account, #registration[data-hook] #account",
|
4
|
+
:template => "spree/user_sessions/new",
|
5
|
+
:disabled => false,
|
6
|
+
:original => 'ab20ac9e90baa11b847b30040aef863d2e1af17a')
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<div data-hook="admin_user_form_fields">
|
2
|
+
<%= f.field_container :email do %>
|
3
|
+
<%= f.label :email, t(:email) %><br />
|
4
|
+
<%= f.email_field :email %>
|
5
|
+
<%= error_message_on :user, :email %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<%= f.field_container :password do %>
|
9
|
+
<%= f.label :password, t(:password) %><br />
|
10
|
+
<%= f.password_field :password %>
|
11
|
+
<%= f.error_message_on :password %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<%= f.field_container :password do %>
|
15
|
+
<%= f.label :password_confirmation, t(:confirm_password) %><br />
|
16
|
+
<%= f.password_field :password_confirmation %>
|
17
|
+
<%= f.error_message_on :password_confirmation %>
|
18
|
+
<% end %>
|
19
|
+
</div>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div data-hook="admin_user_form_roles">
|
2
|
+
<p>
|
3
|
+
<%= label_tag nil, t(:roles) %><br />
|
4
|
+
<% @roles.each do |role| %>
|
5
|
+
<label class="sub">
|
6
|
+
<%= check_box_tag 'user[spree_role_ids][]', role.id, @user.spree_roles.include?(role), :id => "user_spree_role_#{role.name}" %>
|
7
|
+
<%= role.name %>
|
8
|
+
</label>
|
9
|
+
<% end %>
|
10
|
+
<%= hidden_field_tag 'user[spree_role_ids][]', '' %>
|
11
|
+
</p>
|
12
|
+
</div>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div data-hook="admin_user_edit_form_header">
|
2
|
+
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @user } %>
|
3
|
+
<h1><%= t(:editing_user) %></h1>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<div data-hook="admin_user_edit_form">
|
7
|
+
<%= form_for [:admin, @user] do |f| %>
|
8
|
+
<%= render :partial => 'form', :locals => { :f => f } %>
|
9
|
+
|
10
|
+
<div data-hook="admin_user_edit_form_button">
|
11
|
+
<%= render :partial => 'spree/admin/shared/edit_resource_links' %>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
</div>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<div class="toolbar" data-hook="toolbar">
|
2
|
+
<ul class="actions">
|
3
|
+
<li>
|
4
|
+
<p><%= button_link_to t(:new_user), new_object_url, :icon => 'add', :id => 'admin_new_user_link' %></p>
|
5
|
+
</li>
|
6
|
+
</ul>
|
7
|
+
<br class="clear" />
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<h1><%= t(:listing_users) %></h1>
|
11
|
+
|
12
|
+
<table class="index" id="listing_users" data-hook>
|
13
|
+
<thead>
|
14
|
+
<tr data-hook="admin_users_index_headers">
|
15
|
+
<th><%= sort_link @search,:email, t(:user), {}, {:title => 'users_email_title'} %></th>
|
16
|
+
<th data-hook="admin_users_index_header_actions"></th>
|
17
|
+
</tr>
|
18
|
+
</thead>
|
19
|
+
<tbody>
|
20
|
+
<% @users.each do |user|%>
|
21
|
+
<tr id="<%= spree_dom_id user %>" data-hook="admin_users_index_rows">
|
22
|
+
<td width="350px" class='user_email'><%=link_to user.email, object_url(user) %></td>
|
23
|
+
<td data-hook="admin_users_index_row_actions">
|
24
|
+
<%= link_to_edit user, :class => 'edit' %>
|
25
|
+
<%= link_to_delete user %>
|
26
|
+
</td>
|
27
|
+
</tr>
|
28
|
+
<% end %>
|
29
|
+
</tbody>
|
30
|
+
</table>
|
31
|
+
|
32
|
+
<%= paginate @users %>
|
33
|
+
|
34
|
+
|
35
|
+
<% content_for :sidebar do %>
|
36
|
+
<div class="box" data-hook="admin_users_index_search">
|
37
|
+
<h3><%= t(:search) %></h3>
|
38
|
+
<%= search_form_for [:admin, @search] do |f| %>
|
39
|
+
<p>
|
40
|
+
<%= t(:email) %><br />
|
41
|
+
<%= f.text_field :email_cont, :size =>18 %>
|
42
|
+
</p>
|
43
|
+
<div data-hook="admin_users_index_search_buttons">
|
44
|
+
<p><%= button t(:search) %></p>
|
45
|
+
</div>
|
46
|
+
<% end %>
|
47
|
+
</div>
|
48
|
+
<% end %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div data-hook="admin_user_new_form_header">
|
2
|
+
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @user } %>
|
3
|
+
<h1><%= t(:new_user) %></h1>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<div data-hook="admin_user_new_form">
|
7
|
+
<%= form_for [:admin, @user] do |f| %>
|
8
|
+
<%= render :partial => 'form', :locals => { :f => f } %>
|
9
|
+
|
10
|
+
<div data-hook="admin_user_new_form_buttons">
|
11
|
+
<%= render :partial => 'spree/admin/shared/new_resource_links' %>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
</div>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<h1><%= t(:user_account) %></h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr data-hook="email">
|
5
|
+
<th><%= t(:email) %></th>
|
6
|
+
<td>
|
7
|
+
<%= @user.email %>
|
8
|
+
</td>
|
9
|
+
</tr>
|
10
|
+
<tr data-hook="roles">
|
11
|
+
<th><%= t(:roles) %></th>
|
12
|
+
<td>
|
13
|
+
<%= @user.spree_roles.pluck(:name).join(', ') %>
|
14
|
+
</td>
|
15
|
+
</tr>
|
16
|
+
</table>
|
17
|
+
|
18
|
+
<p>
|
19
|
+
<%= link_to_edit @user, :class => 'edit_user' %> <%= t(:or) %>
|
20
|
+
<%= link_to t(:back), collection_url %>
|
21
|
+
</p>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% if spree_current_user %>
|
2
|
+
<ul id="login-nav">
|
3
|
+
<li><%= t(:logged_in_as) %>: <%= spree_current_user.email %></li>
|
4
|
+
<li><%= link_to t(:account), spree.edit_user_path(spree_current_user) %></li>
|
5
|
+
<li><%= link_to t(:logout), spree.destroy_user_session_path %></li>
|
6
|
+
<li><%= link_to t(:store), spree.products_path %></li>
|
7
|
+
</ul>
|
8
|
+
<% end %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<%= form_for :user, :url => spree.user_session_path do |f| %>
|
2
|
+
<div id="password-credentials">
|
3
|
+
<p>
|
4
|
+
<%= f.label :email, t(:email) %><br />
|
5
|
+
<%= f.email_field :email, :class => 'title', :tabindex => 1 %>
|
6
|
+
</p>
|
7
|
+
<p>
|
8
|
+
<%= f.label :password, t(:password) %><br />
|
9
|
+
<%= f.password_field :password, :class => 'title', :tabindex => 2 %>
|
10
|
+
</p>
|
11
|
+
</div>
|
12
|
+
<p>
|
13
|
+
<label>
|
14
|
+
<%= f.check_box :remember_me %>
|
15
|
+
<%= f.label :remember_me, t(:remember_me) %>
|
16
|
+
</label>
|
17
|
+
</p>
|
18
|
+
|
19
|
+
<p><%= f.submit t(:login), :class => 'button primary', :tabindex => 3 %></p>
|
20
|
+
<% end %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<p>
|
2
|
+
<%= f.label :email, t(:email) %><br />
|
3
|
+
<%= f.email_field :email, :class => 'title' %>
|
4
|
+
</p>
|
5
|
+
<div id="password-credentials">
|
6
|
+
<p>
|
7
|
+
<%= f.label :password, t(:password) %><br />
|
8
|
+
<%= f.password_field :password, :class => 'title' %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<%= f.label :password_confirmation, t(:confirm_password) %><br />
|
13
|
+
<%= f.password_field :password_confirmation, :class => 'title' %>
|
14
|
+
</p>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div data-hook="signup_below_password_fields"></div>
|
@@ -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,15 @@
|
|
1
|
+
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @user } %>
|
2
|
+
<h2><%= t(:change_my_password) %></h2>
|
3
|
+
|
4
|
+
<%= form_for @user, :url => spree.user_password_path, :method => :put do |f| %>
|
5
|
+
<p>
|
6
|
+
<%= f.label :password, t(:password) %><br />
|
7
|
+
<%= f.password_field :password %><br />
|
8
|
+
</p>
|
9
|
+
<p>
|
10
|
+
<%= f.label :password_confirmation, t(:password_confirmation) %><br />
|
11
|
+
<%= f.password_field :password_confirmation %><br />
|
12
|
+
</p>
|
13
|
+
<%= f.hidden_field :reset_password_token %>
|
14
|
+
<%= f.submit t(:update_password), :class => 'button primary' %>
|
15
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div id="forgot-password">
|
2
|
+
<h6><%= t(:forgot_password) %></h6>
|
3
|
+
|
4
|
+
<p><%= t(:instructions_to_reset_password) %></p>
|
5
|
+
|
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>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<% @body_id = 'signup' %>
|
2
|
+
|
3
|
+
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @user } %>
|
4
|
+
|
5
|
+
<div id="new-customer">
|
6
|
+
<h6><%= t(:new_customer) %></h6>
|
7
|
+
|
8
|
+
<div data-hook="signup">
|
9
|
+
|
10
|
+
<%= form_for :user, :url => spree.user_registration_path(@user) do |f| %>
|
11
|
+
<div data-hook="signup_inside_form">
|
12
|
+
<%= render :partial => 'spree/shared/user_form', :locals => { :f => f } %>
|
13
|
+
<p><%= f.submit t(:create), :class => 'button primary' %></p>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
<%= t(:or) %> <%= link_to t(:login_as_existing), spree.login_path %>
|
17
|
+
|
18
|
+
</div>
|
19
|
+
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div data-hook="login_extras"></div>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<% if flash[:alert] %>
|
2
|
+
<div class="flash errors"><%= flash[:alert] %></div>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<% @body_id = 'login' %>
|
6
|
+
<div id="existing-customer">
|
7
|
+
<h6><%= t(:login_as_existing) %></h6>
|
8
|
+
<div data-hook="login">
|
9
|
+
<%= render :partial => 'spree/shared/login' %>
|
10
|
+
<%= t(:or) %> <%= link_to t(:create_a_new_account), spree.signup_path %> | <%= link_to t(:forgot_password), spree.new_user_password_path %>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
<div data-hook="login_extras"></div>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @user } %>
|
2
|
+
|
3
|
+
<h1><%= t(:editing_user) %></h1>
|
4
|
+
|
5
|
+
<%= form_for @user, :url => spree.user_path(@user), :method => :put do |f| %>
|
6
|
+
<%= render :partial => 'spree/shared/user_form', :locals => { :f => f } %>
|
7
|
+
<p>
|
8
|
+
<%= f.submit t(:update), :class => 'button primary' %>
|
9
|
+
</p>
|
10
|
+
<% end %>
|
11
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<h1><%= accurate_title %></h1>
|
2
|
+
|
3
|
+
<div data-hook="account_summary" class="account-summary">
|
4
|
+
<dl id="user-info">
|
5
|
+
<dt><%= t(:email) %></dt>
|
6
|
+
<dd><%= @user.email %> (<%= link_to t(:edit), spree.edit_account_path %>)</dd>
|
7
|
+
</dl>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div data-hook="account_my_orders" class="account-my-orders">
|
11
|
+
|
12
|
+
<h3><%= t(:my_orders) %></h3>
|
13
|
+
<% if @orders.present? %>
|
14
|
+
<table class="order-summary">
|
15
|
+
<thead>
|
16
|
+
<tr>
|
17
|
+
<th class="order-number"><%= t(:order_number) %></th>
|
18
|
+
<th class="order-date"><%= t(:order_date) %></th>
|
19
|
+
<th class="order-status"><%= t(:status) %></th>
|
20
|
+
<th class="order-payment-state"><%= t(:payment_state) %></th>
|
21
|
+
<th class="order-shipment-state"><%= t(:shipment_state) %></th>
|
22
|
+
<th class="order-total"><%= t(:total) %></th>
|
23
|
+
</tr>
|
24
|
+
</thead>
|
25
|
+
<tbody>
|
26
|
+
<% @orders.each do |order| %>
|
27
|
+
<tr class="<%= cycle('even', 'odd') %>">
|
28
|
+
<td class="order-number"><%= link_to order.number, order_url(order) %></td>
|
29
|
+
<td class="order-date"><%= l order.created_at.to_date %></td>
|
30
|
+
<td class="order-status"><%= t(order.state).titleize %></td>
|
31
|
+
<td class="order-payment-state"><%= t("payment_states.#{order.payment_state}") if order.payment_state %></td>
|
32
|
+
<td class="order-shipment-state"><%= t("shipment_states.#{order.shipment_state}") if order.shipment_state %></td>
|
33
|
+
<td class="order-total"><%= money order.total %></td>
|
34
|
+
</tr>
|
35
|
+
<% end %>
|
36
|
+
</tbody>
|
37
|
+
</table>
|
38
|
+
<% else %>
|
39
|
+
<p><%= t(:you_have_no_orders_yet) %></p>
|
40
|
+
<% end %>
|
41
|
+
<br />
|
42
|
+
|
43
|
+
</div>
|
@@ -0,0 +1,142 @@
|
|
1
|
+
# Use this hook to configure devise mailer, warden hooks and so forth. The first
|
2
|
+
# four configuration values can also be set straight in your models.
|
3
|
+
Devise.setup do |config|
|
4
|
+
# ==> Mailer Configuration
|
5
|
+
# Configure the e-mail address which will be shown in DeviseMailer.
|
6
|
+
config.mailer_sender = 'please-change-me@config-initializers-devise.com'
|
7
|
+
|
8
|
+
# Configure the class responsible to send e-mails.
|
9
|
+
config.mailer = 'Spree::UserMailer'
|
10
|
+
|
11
|
+
# ==> ORM configuration
|
12
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
13
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
14
|
+
# available as additional gems.
|
15
|
+
require 'devise/orm/active_record'
|
16
|
+
|
17
|
+
# ==> Configuration for any authentication mechanism
|
18
|
+
# Configure which keys are used when authenticating an user. By default is
|
19
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
20
|
+
# authenticating an user, both parameters are required. Remember that those
|
21
|
+
# parameters are used only when authenticating and not when retrieving from
|
22
|
+
# session. If you need permissions, you should implement that in a before filter.
|
23
|
+
# config.authentication_keys = [ :email ]
|
24
|
+
|
25
|
+
# Tell if authentication through request.params is enabled. True by default.
|
26
|
+
# config.params_authenticatable = true
|
27
|
+
|
28
|
+
# Tell if authentication through HTTP Basic Auth is enabled. False by default.
|
29
|
+
config.http_authenticatable = true
|
30
|
+
|
31
|
+
# Set this to true to use Basic Auth for AJAX requests. True by default.
|
32
|
+
#config.http_authenticatable_on_xhr = false
|
33
|
+
|
34
|
+
# The realm used in Http Basic Authentication
|
35
|
+
config.http_authentication_realm = 'Spree Application'
|
36
|
+
|
37
|
+
# ==> Configuration for :database_authenticatable
|
38
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
39
|
+
# using other encryptors, it sets how many times you want the password re-encrypted.
|
40
|
+
config.stretches = 20
|
41
|
+
|
42
|
+
# Setup a pepper to generate the encrypted password.
|
43
|
+
config.pepper = '0bfa9e2cb4a5efd0d976518a3d82e345060547913d2fd1dd2f32b0c8dbbbb5d3dc20b86d0fed31aca9513bccdf51643700ea277d9c64d9ce8ef886bf39293453'
|
44
|
+
|
45
|
+
# ==> Configuration for :confirmable
|
46
|
+
# The time you want to give your user to confirm his account. During this time
|
47
|
+
# he will be able to access your application without confirming. Default is nil.
|
48
|
+
# When confirm_within is zero, the user won't be able to sign in without confirming.
|
49
|
+
# You can use this to let your user access some features of your application
|
50
|
+
# without confirming the account, but blocking it after a certain period
|
51
|
+
# (ie 2 days).
|
52
|
+
# config.confirm_within = 2.days
|
53
|
+
|
54
|
+
# ==> Configuration for :rememberable
|
55
|
+
# The time the user will be remembered without asking for credentials again.
|
56
|
+
# config.remember_for = 2.weeks
|
57
|
+
|
58
|
+
# If true, a valid remember token can be re-used between multiple browsers.
|
59
|
+
# config.remember_across_browsers = true
|
60
|
+
|
61
|
+
# If true, extends the user's remember period when remembered via cookie.
|
62
|
+
# config.extend_remember_period = false
|
63
|
+
|
64
|
+
# ==> Configuration for :validatable
|
65
|
+
# Range for password length
|
66
|
+
# config.password_length = 6..20
|
67
|
+
|
68
|
+
# Regex to use to validate the email address
|
69
|
+
config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
|
70
|
+
|
71
|
+
# ==> Configuration for :timeoutable
|
72
|
+
# The time you want to timeout the user session without activity. After this
|
73
|
+
# time the user will be asked for credentials again.
|
74
|
+
# config.timeout_in = 10.minutes
|
75
|
+
|
76
|
+
# ==> Configuration for :lockable
|
77
|
+
# Defines which strategy will be used to lock an account.
|
78
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
79
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
80
|
+
# config.lock_strategy = :failed_attempts
|
81
|
+
|
82
|
+
# Defines which strategy will be used to unlock an account.
|
83
|
+
# :email = Sends an unlock link to the user email
|
84
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
85
|
+
# :both = Enables both strategies
|
86
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
87
|
+
# config.unlock_strategy = :both
|
88
|
+
|
89
|
+
# Number of authentication tries before locking an account if lock_strategy
|
90
|
+
# is failed attempts.
|
91
|
+
# config.maximum_attempts = 20
|
92
|
+
|
93
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
94
|
+
# config.unlock_in = 1.hour
|
95
|
+
|
96
|
+
# ==> Configuration for :token_authenticatable
|
97
|
+
# Defines name of the authentication token params key
|
98
|
+
config.token_authentication_key = :auth_token
|
99
|
+
|
100
|
+
# ==> Scopes configuration
|
101
|
+
# Turn scoped views on. Before rendering 'sessions/new', it will first check for
|
102
|
+
# 'users/sessions/new'. It's turned off by default because it's slower if you
|
103
|
+
# are using only default views.
|
104
|
+
# config.scoped_views = true
|
105
|
+
|
106
|
+
# Configure the default scope given to Warden. By default it's the first
|
107
|
+
# devise role declared in your routes.
|
108
|
+
# config.default_scope = :user
|
109
|
+
|
110
|
+
# Configure sign_out behavior.
|
111
|
+
# By default sign_out is scoped (i.e. /users/sign_out affects only :user scope).
|
112
|
+
# In case of sign_out_all_scopes set to true any logout action will sign out all active scopes.
|
113
|
+
# config.sign_out_all_scopes = false
|
114
|
+
|
115
|
+
# ==> Navigation configuration
|
116
|
+
# Lists the formats that should be treated as navigational. Formats like
|
117
|
+
# :html, should redirect to the sign in page when the user does not have
|
118
|
+
# access, but formats like :xml or :json, should return 401.
|
119
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
120
|
+
# should add them to the navigational formats lists. Default is [:html]
|
121
|
+
config.navigational_formats = [:html, :json, :xml]
|
122
|
+
|
123
|
+
# ==> Warden configuration
|
124
|
+
# If you want to use other strategies, that are not (yet) supported by Devise,
|
125
|
+
# you can configure them inside the config.warden block. The example below
|
126
|
+
# allows you to setup OAuth, using http://github.com/roman/warden_oauth
|
127
|
+
#
|
128
|
+
# config.warden do |manager|
|
129
|
+
# manager.oauth(:twitter) do |twitter|
|
130
|
+
# twitter.consumer_secret = <YOUR CONSUMER SECRET>
|
131
|
+
# twitter.consumer_key = <YOUR CONSUMER KEY>
|
132
|
+
# twitter.options :site => 'http://twitter.com'
|
133
|
+
# end
|
134
|
+
# manager.default_strategies(:scope => :user).unshift :twitter_oauth
|
135
|
+
# end
|
136
|
+
#
|
137
|
+
# Time interval you can reset your password with a reset password key.
|
138
|
+
# Don't put a too small interval or your users won't have the time to
|
139
|
+
# change their passwords.
|
140
|
+
config.reset_password_within = 6.hours
|
141
|
+
config.sign_out_via = :get
|
142
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Spree.user_class = "Spree::User"
|
@@ -0,0 +1,46 @@
|
|
1
|
+
en:
|
2
|
+
errors:
|
3
|
+
messages:
|
4
|
+
not_found: 'not found'
|
5
|
+
already_confirmed: 'was already confirmed'
|
6
|
+
not_locked: 'was not locked'
|
7
|
+
not_saved:
|
8
|
+
one: '1 error prohibited this %{resource} from being saved:'
|
9
|
+
other: '%{count} errors prohibited this %{resource} from being saved:'
|
10
|
+
devise:
|
11
|
+
failure:
|
12
|
+
unauthenticated: 'You need to sign in or sign up before continuing.'
|
13
|
+
unconfirmed: 'You have to confirm your account before continuing.'
|
14
|
+
locked: 'Your account is locked.'
|
15
|
+
invalid: 'Invalid email or password.'
|
16
|
+
invalid_token: 'Invalid authentication token.'
|
17
|
+
timeout: 'Your session expired, please sign in again to continue.'
|
18
|
+
inactive: 'Your account was not activated yet.'
|
19
|
+
user_passwords:
|
20
|
+
user:
|
21
|
+
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
|
22
|
+
updated: 'Your password was changed successfully. You are now signed in.'
|
23
|
+
confirmations:
|
24
|
+
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
|
25
|
+
confirmed: 'Your account was successfully confirmed. You are now signed in.'
|
26
|
+
user_registrations:
|
27
|
+
signed_up: 'Welcome! You have signed up successfully.'
|
28
|
+
inactive_signed_up: 'You have signed up successfully. However, we could not sign you in because your account is %{reason}.'
|
29
|
+
updated: 'You updated your account successfully.'
|
30
|
+
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
|
31
|
+
user_sessions:
|
32
|
+
signed_in: 'Signed in successfully.'
|
33
|
+
signed_out: 'Signed out successfully.'
|
34
|
+
unlocks:
|
35
|
+
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
|
36
|
+
unlocked: 'Your account was successfully unlocked. You are now signed in.'
|
37
|
+
oauth_callbacks:
|
38
|
+
success: 'Successfully authorized from %{kind} account.'
|
39
|
+
failure: 'Could not authorize you from %{kind} because "%{reason}".'
|
40
|
+
mailer:
|
41
|
+
confirmation_instructions:
|
42
|
+
subject: 'Confirmation instructions'
|
43
|
+
reset_password_instructions:
|
44
|
+
subject: 'Reset password instructions'
|
45
|
+
unlock_instructions:
|
46
|
+
subject: 'Unlock Instructions'
|
data/config/routes.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
Spree::Core::Engine.routes.draw do
|
2
|
+
devise_for :user,
|
3
|
+
:class_name => 'Spree::User',
|
4
|
+
:controllers => { :sessions => 'spree/user_sessions',
|
5
|
+
:registrations => 'spree/user_registrations',
|
6
|
+
:passwords => 'spree/user_passwords' },
|
7
|
+
:skip => [:unlocks, :omniauth_callbacks],
|
8
|
+
:path_names => { :sign_out => 'logout' }
|
9
|
+
end
|
10
|
+
|
11
|
+
Spree::Core::Engine.routes.prepend do
|
12
|
+
resources :users, :only => [:edit, :update]
|
13
|
+
|
14
|
+
devise_scope :user do
|
15
|
+
get '/login' => 'user_sessions#new', :as => :login
|
16
|
+
get '/signup' => 'user_registrations#new', :as => :signup
|
17
|
+
end
|
18
|
+
|
19
|
+
match '/checkout/registration' => 'checkout#registration', :via => :get, :as => :checkout_registration
|
20
|
+
match '/checkout/registration' => 'checkout#update_registration', :via => :put, :as => :update_checkout_registration
|
21
|
+
|
22
|
+
match '/orders/:id/token/:token' => 'orders#show', :via => :get, :as => :token_order
|
23
|
+
|
24
|
+
resource :session do
|
25
|
+
member do
|
26
|
+
get :nav_bar
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
resource :account, :controller => 'users'
|
31
|
+
end
|