trusty-cms 3.8.0 → 3.8.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +100 -92
- data/app/assets/images/admin/default_forgot_password.svg +1 -0
- data/app/assets/images/admin/default_reset_password.svg +1 -0
- data/app/assets/images/admin/default_safe_login.svg +1 -0
- data/app/assets/javascripts/admin.js +0 -1
- data/app/assets/javascripts/admin/modernizr.js +3 -409
- data/app/assets/stylesheets/admin/partials/_forms.scss +39 -0
- data/app/assets/stylesheets/admin/partials/_layout.scss +8 -0
- data/app/assets/stylesheets/admin/partials/_validations.scss +6 -13
- data/app/controllers/admin/assets_controller.rb +7 -0
- data/app/controllers/admin/preferences_controller.rb +1 -1
- data/app/controllers/admin/resource_controller.rb +6 -0
- data/app/controllers/admin/users_controller.rb +3 -2
- data/app/controllers/application_controller.rb +5 -7
- data/app/controllers/site_controller.rb +2 -1
- data/app/controllers/social_mailer_controller.rb +2 -1
- data/app/models/legacy_user.rb +6 -0
- data/app/models/user.rb +39 -68
- data/app/models/user_action_observer.rb +4 -2
- data/app/views/admin/configuration/show.html.haml +2 -7
- data/app/views/admin/layouts/_site_chooser.html.haml +1 -1
- data/app/views/admin/pages/_node.html.haml +2 -2
- data/app/views/admin/preferences/edit.html.haml +9 -14
- data/app/views/admin/users/_form.html.haml +8 -15
- data/app/views/admin/users/index.html.haml +0 -1
- data/app/views/devise/passwords/edit.html.haml +23 -0
- data/app/views/devise/passwords/new.html.haml +14 -0
- data/app/views/devise/sessions/new.html.haml +25 -0
- data/app/views/devise/shared/_links.html.haml +16 -0
- data/app/views/layouts/application.html.haml +1 -1
- data/config/application.rb +1 -0
- data/config/initializers/devise.rb +310 -0
- data/config/routes.rb +6 -10
- data/db/migrate/20200117141251_create_admin_users.rb +51 -0
- data/lib/generators/extension_controller/templates/controller.rb +1 -1
- data/lib/login_system.rb +40 -44
- data/lib/tasks/upgrade_to_devise.rake +22 -0
- data/lib/trusty_cms.rb +1 -1
- data/lib/trusty_cms/admin_ui.rb +3 -3
- data/lib/trusty_cms/engine.rb +2 -0
- data/lib/trusty_cms/setup.rb +0 -1
- data/trusty_cms.gemspec +1 -0
- data/vendor/extensions/clipped-extension/clipped_extension.rb +0 -2
- data/vendor/extensions/multi-site-extension/lib/multi_site/site_chooser_helper.rb +1 -1
- data/vendor/extensions/snippets-extension/snippets_extension.rb +0 -2
- metadata +27 -8
- data/app/assets/javascripts/admin/cookie.js +0 -80
- data/app/controllers/admin/password_resets_controller.rb +0 -31
- data/app/controllers/admin/welcome_controller.rb +0 -47
- data/app/views/admin/password_resets/edit.html.haml +0 -27
- data/app/views/admin/password_resets/new.html.haml +0 -12
- data/app/views/password_mailer/password_reset.html.haml +0 -8
@@ -1,80 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
cookie.js
|
3
|
-
|
4
|
-
Copyright (c) 2007, 2008 Maxime Haineault
|
5
|
-
(http://www.haineault.com/code/cookie-js/, http://code.google.com/p/cookie-js/)
|
6
|
-
|
7
|
-
Portions Copyright (c) 2008, John W. Long
|
8
|
-
|
9
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
10
|
-
a copy of this software and associated documentation files (the
|
11
|
-
"Software"), to deal in the Software without restriction, including
|
12
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
13
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
14
|
-
permit persons to whom the Software is furnished to do so, subject to
|
15
|
-
the following conditions:
|
16
|
-
|
17
|
-
The above copyright notice and this permission notice shall be
|
18
|
-
included in all copies or substantial portions of the Software.
|
19
|
-
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
21
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
23
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
24
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
25
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
26
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27
|
-
*/
|
28
|
-
|
29
|
-
Cookie = {
|
30
|
-
get: function(name) {
|
31
|
-
// Still not sure that "[a-zA-Z0-9.()=|%/]+($|;)" match *all* allowed characters in cookies
|
32
|
-
tmp = document.cookie.match((new RegExp(name +'=[a-zA-Z0-9.()=|%/]+($|;)','g')));
|
33
|
-
if (!tmp || !tmp[0]) {
|
34
|
-
return null;
|
35
|
-
} else {
|
36
|
-
return unescape(tmp[0].substring(name.length + 1, tmp[0].length).replace(';', '')) || null;
|
37
|
-
}
|
38
|
-
},
|
39
|
-
|
40
|
-
set: function(name, value, expireInHours, path, domain, secure) {
|
41
|
-
var cookie = [
|
42
|
-
name + '=' + escape(value),
|
43
|
-
'path=' + ((!path || path == '') ? '/' : path)
|
44
|
-
];
|
45
|
-
if (Cookie._notEmpty(domain)) cookie.push('domain=' + domain);
|
46
|
-
if (Cookie._notEmpty(expireInHours)) cookie.push(Cookie._hoursToExpireDate(expireInHours));
|
47
|
-
if (Cookie._notEmpty(secure)) cookie.push('secure');
|
48
|
-
return document.cookie = cookie.join(';');
|
49
|
-
},
|
50
|
-
|
51
|
-
erase: function(name, path, domain) {
|
52
|
-
path = (!path || typeof path != 'string') ? '' : path;
|
53
|
-
domain = (!domain || typeof domain != 'string') ? '' : domain;
|
54
|
-
if (Cookie.get(name)) Cookie.set(name, '', 'Thu, 01-Jan-70 00:00:01 GMT', path, domain);
|
55
|
-
},
|
56
|
-
|
57
|
-
// Returns true if cookies are enabled
|
58
|
-
accept: function() {
|
59
|
-
Cookie.set('b49f729efde9b2578ea9f00563d06e57', 'true');
|
60
|
-
if (Cookie.get('b49f729efde9b2578ea9f00563d06e57') == 'true') {
|
61
|
-
Cookie.erase('b49f729efde9b2578ea9f00563d06e57');
|
62
|
-
return true;
|
63
|
-
}
|
64
|
-
return false;
|
65
|
-
},
|
66
|
-
|
67
|
-
_notEmpty: function(value) {
|
68
|
-
return (typeof value != 'undefined' && value != null && value != '');
|
69
|
-
},
|
70
|
-
|
71
|
-
// Private function for calculating the date of expiration based on hours
|
72
|
-
_hoursToExpireDate: function(hours) {
|
73
|
-
if (parseInt(hours) == 'NaN' ) return '';
|
74
|
-
else {
|
75
|
-
now = new Date();
|
76
|
-
now.setTime(now.getTime() + (parseInt(hours) * 60 * 60 * 1000));
|
77
|
-
return now.toGMTString();
|
78
|
-
}
|
79
|
-
}
|
80
|
-
};
|
@@ -1,31 +0,0 @@
|
|
1
|
-
class Admin::PasswordResetsController < ApplicationController
|
2
|
-
no_login_required
|
3
|
-
|
4
|
-
def create
|
5
|
-
user = User.find_by_email(params[:email])
|
6
|
-
user.send_password_reset if user
|
7
|
-
redirect_to welcome_path, :notice => "If the e-mail address you entered is associated with a customer account in our records, you will receive an e-mail from us with instructions for resetting your password.
|
8
|
-
If you don't receive this e-mail, please check your junk mail folder or speak with your TrustyCMS administrator."
|
9
|
-
end
|
10
|
-
|
11
|
-
def edit
|
12
|
-
@user = User.find_by_password_reset_token!(params[:id])
|
13
|
-
end
|
14
|
-
|
15
|
-
def update
|
16
|
-
@user = User.find_by_password_reset_token!(params[:id])
|
17
|
-
if @user.password_reset_sent_at < 2.hours.ago
|
18
|
-
redirect_to new_password_reset_path, :alert => "Password reset has expired."
|
19
|
-
elsif @user.update_attributes(password_params)
|
20
|
-
redirect_to welcome_url, :notice => "Password has been reset!"
|
21
|
-
else
|
22
|
-
render :edit
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def password_params
|
29
|
-
params.require(:user).permit(:password, :password_confirmation)
|
30
|
-
end
|
31
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
class Admin::WelcomeController < ApplicationController
|
2
|
-
no_login_required
|
3
|
-
before_action :never_cache
|
4
|
-
|
5
|
-
def index
|
6
|
-
redirect_to admin_pages_path
|
7
|
-
end
|
8
|
-
|
9
|
-
def login
|
10
|
-
if request.post?
|
11
|
-
@username_or_email = params[:username_or_email]
|
12
|
-
password = params[:password]
|
13
|
-
announce_invalid_user unless self.current_user = User.authenticate(@username_or_email, password)
|
14
|
-
end
|
15
|
-
if current_user
|
16
|
-
if params[:remember_me]
|
17
|
-
current_user.remember_me
|
18
|
-
set_session_cookie
|
19
|
-
end
|
20
|
-
redirect_to(session[:return_to] || welcome_path)
|
21
|
-
session[:return_to] = nil
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def logout
|
26
|
-
request.cookies[:session_token] = { :expires => 1.day.ago.utc }
|
27
|
-
self.current_user.forget_me if self.current_user
|
28
|
-
self.current_user = nil
|
29
|
-
announce_logged_out
|
30
|
-
redirect_to login_path
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def never_cache
|
36
|
-
expires_now
|
37
|
-
end
|
38
|
-
|
39
|
-
def announce_logged_out
|
40
|
-
flash[:notice] = t('welcome_controller.logged_out')
|
41
|
-
end
|
42
|
-
|
43
|
-
def announce_invalid_user
|
44
|
-
flash.now[:error] = t('welcome_controller.invalid_user')
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
- body_classes << "single_form"
|
2
|
-
|
3
|
-
#single_form
|
4
|
-
|
5
|
-
%h3= t('reset_your_password')
|
6
|
-
|
7
|
-
= form_for @user, :url => admin_password_reset_path(params[:id]) do |f|
|
8
|
-
- if @user.errors.any?
|
9
|
-
.error_messages
|
10
|
-
%h2 Form is invalid
|
11
|
-
%ul
|
12
|
-
- for message in @user.errors.full_messages
|
13
|
-
%li= message
|
14
|
-
%p
|
15
|
-
%label{:for=>"password"}= t('password')
|
16
|
-
= f.password_field :password
|
17
|
-
%p
|
18
|
-
%label{:for=>"password_confirmation"}= t('password_confirmation')
|
19
|
-
= f.password_field :password_confirmation
|
20
|
-
.actions= f.submit "Update Password"
|
21
|
-
|
22
|
-
%p.version
|
23
|
-
= t('powered_by')
|
24
|
-
%a{ :href => "https://github.com/pgharts/trusty-cms" } TrustyCms CMS
|
25
|
-
= t('version')
|
26
|
-
= TrustyCms.loaded_via_gem? ? "#{TrustyCms::VERSION} (gem)." : "#{TrustyCms::VERSION}."
|
27
|
-
|
@@ -1,12 +0,0 @@
|
|
1
|
-
- body_classes << "single_form"
|
2
|
-
|
3
|
-
#single_form
|
4
|
-
|
5
|
-
%h3= t('reset_your_password')
|
6
|
-
|
7
|
-
= form_tag admin_password_resets_path, :method => :post do
|
8
|
-
%p
|
9
|
-
%label{:for=>"email"}= t('email')
|
10
|
-
= text_field_tag :email, params[:email], :class => 'textbox', :maxlength => 70, :size => 70
|
11
|
-
.actions
|
12
|
-
= submit_tag "Reset Password"
|
@@ -1,8 +0,0 @@
|
|
1
|
-
= "Hi, #{@user.name} -"
|
2
|
-
|
3
|
-
%p
|
4
|
-
We received a request to reset your password.
|
5
|
-
%p
|
6
|
-
= link_to('Click here to reset', edit_admin_password_reset_url(@user.password_reset_token))
|
7
|
-
%p
|
8
|
-
If you did not request your password to be reset, please alert your TrustyCMS Admin.
|