tb_core 1.2.7 → 1.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/admin/password_resets_controller.rb +1 -1
- data/app/controllers/admin/settings_controller.rb +1 -1
- data/app/controllers/admin/setup_controller.rb +2 -2
- data/app/controllers/password_resets_controller.rb +1 -1
- data/app/controllers/spud/application_controller.rb +12 -11
- data/app/controllers/user_sessions_controller.rb +1 -1
- data/app/models/spud/spud_user_model.rb +14 -1
- data/app/views/admin/settings/_form.html.erb +9 -7
- data/app/views/admin/setup/new.html.erb +18 -4
- data/app/views/admin/user_sessions/new.html.erb +8 -3
- data/app/views/admin/users/_form.html.erb +10 -8
- data/app/views/admin/users/show.html.erb +4 -2
- data/app/views/password_resets/show.html.erb +3 -0
- data/app/views/user_sessions/new.html.erb +11 -3
- data/lib/spud_core/configuration.rb +4 -1
- data/lib/spud_core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 739d972307395196f258e7586655f5d3e4dc05f4
|
4
|
+
data.tar.gz: 4c96571597213dd796a09b8b7a2616a6987e69ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1de99edf127c590639325dbf5b3241b329b2d5ec211eaff041e590db6a318707a297efa4909aa3354faca84a878ac1d84134dfc01d07d039c780e9ca0a4647a7
|
7
|
+
data.tar.gz: fde33ac415dd3fe5701d098a48f91a9f16191f3b82708776e923986c857e754efa02a18012537338020c3643403ad860785319b54f195c2e12c4b85833c76907
|
@@ -30,7 +30,7 @@ class Admin::PasswordResetsController < Admin::ApplicationController
|
|
30
30
|
@user.password = params[:spud_user][:password]
|
31
31
|
@user.password_confirmation = params[:spud_user][:password_confirmation]
|
32
32
|
if @user.save
|
33
|
-
SpudUserSession.create(
|
33
|
+
SpudUserSession.create(@user)
|
34
34
|
flash[:notice] = "Password successfully updated"
|
35
35
|
redirect_to admin_login_path
|
36
36
|
else
|
@@ -16,7 +16,7 @@ class Admin::SettingsController < Admin::ApplicationController
|
|
16
16
|
def update
|
17
17
|
if @current_user.update_attributes(user_params)
|
18
18
|
if user_params.include?(:password)
|
19
|
-
SpudUserSession.create(
|
19
|
+
SpudUserSession.create(@current_user)
|
20
20
|
end
|
21
21
|
flash[:notice] = "User settings saved successfully."
|
22
22
|
respond_with @current_user, :location => admin_settings_path
|
@@ -15,7 +15,7 @@ class Admin::SetupController < Admin::ApplicationController
|
|
15
15
|
@spud_user = SpudUser.new(user_params)
|
16
16
|
@spud_user.super_admin = true
|
17
17
|
if @spud_user.save
|
18
|
-
SpudUserSession.create(
|
18
|
+
SpudUserSession.create(@spud_user)
|
19
19
|
redirect_to admin_root_path
|
20
20
|
else
|
21
21
|
render 'new', :status => 422
|
@@ -25,7 +25,7 @@ class Admin::SetupController < Admin::ApplicationController
|
|
25
25
|
private
|
26
26
|
|
27
27
|
def user_params
|
28
|
-
params.require(:spud_user).permit(:login, :email, :password, :password_confirmation)
|
28
|
+
params.require(:spud_user).permit(:login, :email, :password, :password_confirmation, :first_name, :last_name)
|
29
29
|
end
|
30
30
|
|
31
31
|
end
|
@@ -32,7 +32,7 @@ class PasswordResetsController < ApplicationController
|
|
32
32
|
@user.password = params[:spud_user][:password]
|
33
33
|
@user.password_confirmation = params[:spud_user][:password_confirmation]
|
34
34
|
if @user.save()
|
35
|
-
SpudUserSession.create(
|
35
|
+
SpudUserSession.create(@user)
|
36
36
|
flash[:notice] = "Password successfully updated"
|
37
37
|
redirect_back_or_default(root_path)
|
38
38
|
return
|
@@ -13,7 +13,7 @@ class Spud::ApplicationController < ActionController::Base
|
|
13
13
|
before_action :set_mailer_default_url
|
14
14
|
|
15
15
|
rescue_from Spud::RequestError, :with => :handle_request_error
|
16
|
-
rescue_from ActionController::UnknownFormat, :with => :handle_unknown_format_error
|
16
|
+
rescue_from ActionController::UnknownFormat, ActionView::MissingTemplate, :with => :handle_unknown_format_error
|
17
17
|
|
18
18
|
def not_found
|
19
19
|
raise Spud::NotFoundError
|
@@ -72,9 +72,13 @@ private
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def back_or_default(default)
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
if params[:return_to]
|
76
|
+
return params[:return_to]
|
77
|
+
elsif session[:return_to]
|
78
|
+
return session[:return_to]
|
79
|
+
else
|
80
|
+
return default
|
81
|
+
end
|
78
82
|
end
|
79
83
|
|
80
84
|
def set_time_zone
|
@@ -111,13 +115,10 @@ private
|
|
111
115
|
end
|
112
116
|
|
113
117
|
def handle_unknown_format_error(error)
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
def handle_routing_error(error)
|
119
|
-
error = Spud::NotFoundError.new()
|
120
|
-
handle_request_error(error)
|
118
|
+
if Rails.env.production?
|
119
|
+
error = Spud::NotFoundError.new()
|
120
|
+
handle_request_error(error)
|
121
|
+
end
|
121
122
|
end
|
122
123
|
|
123
124
|
end
|
@@ -11,7 +11,7 @@ class UserSessionsController < ApplicationController
|
|
11
11
|
@user_session = SpudUserSession.new(params[:spud_user_session])
|
12
12
|
if @user_session.save
|
13
13
|
flash[:notice] = "Login successful!"
|
14
|
-
redirect_back_or_default(
|
14
|
+
redirect_back_or_default('/')
|
15
15
|
else
|
16
16
|
render 'new'
|
17
17
|
end
|
@@ -2,13 +2,17 @@ class Spud::SpudUserModel < ActiveRecord::Base
|
|
2
2
|
self.table_name = 'spud_users'
|
3
3
|
|
4
4
|
acts_as_authentic do |c|
|
5
|
-
c.transition_from_crypto_providers = Authlogic::CryptoProviders::Sha512
|
5
|
+
c.transition_from_crypto_providers = Authlogic::CryptoProviders::Sha512
|
6
6
|
c.crypto_provider = Authlogic::CryptoProviders::SCrypt
|
7
7
|
c.logged_in_timeout = 24.hours
|
8
|
+
if Spud::Core.config.use_email_as_login
|
9
|
+
c.login_field = :email
|
10
|
+
end
|
8
11
|
end
|
9
12
|
|
10
13
|
belongs_to :role, :class_name => 'SpudRole', :foreign_key => 'spud_role_id'
|
11
14
|
has_many :spud_user_settings
|
15
|
+
before_validation :set_login_to_email, :if => ->{ Spud::Core.config.use_email_as_login }
|
12
16
|
|
13
17
|
def full_name
|
14
18
|
if first_name.blank? && last_name.blank?
|
@@ -94,4 +98,13 @@ class Spud::SpudUserModel < ActiveRecord::Base
|
|
94
98
|
end
|
95
99
|
end
|
96
100
|
|
101
|
+
private
|
102
|
+
|
103
|
+
def set_login_to_email
|
104
|
+
if self.email.present?
|
105
|
+
self.login = self.email
|
106
|
+
end
|
107
|
+
return true
|
108
|
+
end
|
109
|
+
|
97
110
|
end
|
@@ -2,13 +2,15 @@
|
|
2
2
|
<fieldset>
|
3
3
|
<legend>User Details</legend>
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
</div>
|
5
|
+
<% if !Spud::Core.config.use_email_as_login %>
|
6
|
+
<div class="control-group">
|
7
|
+
<%= f.label :login, :required => true, :class => "control-label" %>
|
8
|
+
<div class="controls">
|
9
|
+
<%= f.text_field :login, :size => 25, :autocomplete => 'username' %>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
12
14
|
<div class="control-group">
|
13
15
|
<%=f.label :email,:class=>"control-label"%>
|
14
16
|
<div class="controls">
|
@@ -8,16 +8,30 @@
|
|
8
8
|
<%= error_messages_for f.object %>
|
9
9
|
<fieldset>
|
10
10
|
<legend>New Admin Account</legend>
|
11
|
+
<% if !Spud::Core.config.use_email_as_login %>
|
12
|
+
<div class="control-group">
|
13
|
+
<%= f.label :login, "Login", :class => "control-label" %>
|
14
|
+
<div class="controls">
|
15
|
+
<%= f.text_field :login %>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
<% end %>
|
11
19
|
<div class="control-group">
|
12
|
-
<%= f.label :
|
20
|
+
<%= f.label :email, "Email", :class => "control-label" %>
|
13
21
|
<div class="controls">
|
14
|
-
<%= f.text_field :
|
22
|
+
<%= f.text_field :email %>
|
15
23
|
</div>
|
16
24
|
</div>
|
17
25
|
<div class="control-group">
|
18
|
-
<%= f.label :
|
26
|
+
<%= f.label :first_name, :class => "control-label" %>
|
19
27
|
<div class="controls">
|
20
|
-
<%= f.text_field :
|
28
|
+
<%= f.text_field :first_name %>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
<div class="control-group">
|
32
|
+
<%= f.label :last_name, :class => "control-label" %>
|
33
|
+
<div class="controls">
|
34
|
+
<%= f.text_field :last_name %>
|
21
35
|
</div>
|
22
36
|
</div>
|
23
37
|
<div class="control-group">
|
@@ -3,12 +3,17 @@
|
|
3
3
|
<%= error_messages_for(f.object) %>
|
4
4
|
|
5
5
|
<div class="login-form-row">
|
6
|
-
|
7
|
-
|
6
|
+
<% if Spud::Core.config.use_email_as_login %>
|
7
|
+
<%= f.label :email %>
|
8
|
+
<%= f.text_field :email, :placeholder => 'Email', :autofocus => 'autofocus', :autocomplete => 'username' %>
|
9
|
+
<% else %>
|
10
|
+
<%= f.label :login %>
|
11
|
+
<%= f.text_field :login, :placeholder => 'Username', :autofocus => 'autofocus', :autocomplete => 'username' %>
|
12
|
+
<% end %>
|
8
13
|
</div>
|
9
14
|
<div class="login-form-row">
|
10
15
|
<%= f.label :password %>
|
11
|
-
<%= f.password_field :password, :autocomplete => 'current-password' %>
|
16
|
+
<%= f.password_field :password, :placeholder => 'Password', :autocomplete => 'current-password' %>
|
12
17
|
</div>
|
13
18
|
<div class="login-form-row">
|
14
19
|
<%= f.submit "Login", :class => 'btn' %> or <%=link_to "Forgot Password?", admin_password_resets_path %>
|
@@ -3,14 +3,16 @@
|
|
3
3
|
<fieldset>
|
4
4
|
<legend>User Details</legend>
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
</div>
|
6
|
+
<% if !Spud::Core.config.use_email_as_login %>
|
7
|
+
<div class="control-group">
|
8
|
+
<%=f.label :login, :required=>true,:class=> "control-label"%>
|
9
|
+
<div class="controls">
|
10
|
+
<%=f.text_field :login,:title => "",:size=>25%>
|
11
|
+
<p class="help-block">This is the username used to login to the account.</p>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
|
14
16
|
<div class="control-group">
|
15
17
|
<%=f.label :email,:class=> "control-label"%>
|
16
18
|
<div class="controls">
|
@@ -12,8 +12,10 @@
|
|
12
12
|
</div>
|
13
13
|
<h2><%= @user.full_name %></h2>
|
14
14
|
<dl>
|
15
|
-
|
16
|
-
|
15
|
+
<% if !Spud::Core.config.use_email_as_login %>
|
16
|
+
<dt>Login</dt>
|
17
|
+
<dd><%= @user.login %></dd>
|
18
|
+
<% end %>
|
17
19
|
<dt>Email</dt>
|
18
20
|
<dd><%= mail_to @user.email %></dd>
|
19
21
|
<dt>Last Login</dt>
|
@@ -4,6 +4,9 @@
|
|
4
4
|
<h1>Password Reset</h1>
|
5
5
|
<%= form_for @user, :url => password_reset_path(:id => @user.perishable_token), :html => {:class => 'password-reset-form'} do |f| %>
|
6
6
|
<%= tb_form_errors(@user) %>
|
7
|
+
<% if params[:return_to] %>
|
8
|
+
<%= hidden_field_tag :return_to, params[:return_to] %>
|
9
|
+
<% end %>
|
7
10
|
<div class="form-row">
|
8
11
|
<%= f.label :password %>
|
9
12
|
<%= f.password_field :password, :placeholder => 'password', :autofocus => 'autofocus' %>
|
@@ -4,13 +4,21 @@
|
|
4
4
|
|
5
5
|
<%= form_for @user_session, :url => login_path, :html => {:class => 'login-form'} do |f| %>
|
6
6
|
<%= tb_form_errors(@user_session) %>
|
7
|
+
<% if params[:return_to] %>
|
8
|
+
<%= hidden_field_tag :return_to, params[:return_to] %>
|
9
|
+
<% end %>
|
7
10
|
<div class="form-row">
|
8
|
-
|
9
|
-
|
11
|
+
<% if Spud::Core.config.use_email_as_login %>
|
12
|
+
<%= f.label :email %>
|
13
|
+
<%= f.text_field :email, :placeholder => 'Email', :autofocus => 'autofocus', :autocomplete => 'username' %>
|
14
|
+
<% else %>
|
15
|
+
<%= f.label :login %>
|
16
|
+
<%= f.text_field :login, :placeholder => 'Username', :autofocus => 'autofocus', :autocomplete => 'username' %>
|
17
|
+
<% end %>
|
10
18
|
</div>
|
11
19
|
<div class="form-row">
|
12
20
|
<%= f.label :password %>
|
13
|
-
<%= f.password_field :password, :placeholder => '
|
21
|
+
<%= f.password_field :password, :placeholder => 'Password', :autocomplete => 'current-password' %>
|
14
22
|
</div>
|
15
23
|
<div class="form-row">
|
16
24
|
<%= f.submit "Login", :class => 'btn btn-primary' %> <span>or</span> <%=link_to "Forgot Password?", password_resets_path %>
|
@@ -1,7 +1,9 @@
|
|
1
1
|
module Spud
|
2
2
|
module Core
|
3
3
|
include ActiveSupport::Configurable
|
4
|
-
config_accessor :site_name
|
4
|
+
config_accessor :site_name, :admin_applications, :sitemap_urls, :multisite_mode_enabled, :multisite_config,
|
5
|
+
:from_address, :site_id, :short_name, :javascripts, :stylesheets, :admin_javascripts, :admin_stylesheets,
|
6
|
+
:permissions, :production_alert_domain, :use_email_as_login
|
5
7
|
self.admin_applications = []
|
6
8
|
self.site_name = "Company Name"
|
7
9
|
self.site_id = 0
|
@@ -16,6 +18,7 @@ module Spud
|
|
16
18
|
self.admin_javascripts = ['admin/core/application', 'admin/application']
|
17
19
|
self.admin_stylesheets = ['admin/core/application', 'admin/application']
|
18
20
|
self.production_alert_domain = nil
|
21
|
+
self.use_email_as_login = false
|
19
22
|
|
20
23
|
def self.site_config_for_host(host)
|
21
24
|
configs = Spud::Core.multisite_config.select{|p| p[:hosts].include?(host)}
|
data/lib/spud_core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tb_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Woods
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|