trestle-auth 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/assets/stylesheets/trestle/_custom-auth.scss +4 -0
- data/app/assets/stylesheets/trestle/auth.scss +4 -0
- data/app/assets/stylesheets/trestle/auth/_defaults.scss +13 -0
- data/app/assets/stylesheets/trestle/auth/_form.scss +36 -30
- data/app/assets/stylesheets/trestle/auth/_layout.scss +1 -1
- data/config/locale/en.yml +5 -5
- data/config/locale/pl.yml +8 -0
- data/config/locale/pt-BR.yml +8 -0
- data/lib/generators/trestle/auth/install/install_generator.rb +13 -0
- data/lib/trestle/auth.rb +1 -0
- data/lib/trestle/auth/configuration.rb +4 -0
- data/lib/trestle/auth/constraint.rb +9 -0
- data/lib/trestle/auth/controller_methods.rb +8 -5
- data/lib/trestle/auth/version.rb +1 -1
- data/trestle-auth.gemspec +0 -1
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 71e10f075c0aee1777d1823511187dfac4d50788006476a5f1a67f9f3555b352
|
4
|
+
data.tar.gz: e00d07780f77c7914eeaffea5574143064dfe5adc514d5c0580d7d794834cff6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46d21d2099835f6d7f80a41f98b6983c1de41c2f4fbec486f7c069038f881a7097d6c78377c41e6a1c9b1a8d2d1e2e453c177de2cbfcfbf44f3e3f9410556b14
|
7
|
+
data.tar.gz: dd803d5a8055402aa4f1b9c6351429c8c4160052e3b2f902db7c830894b78ed9d416f434f0ea99c8e823b043943152465a49df4cd3023494539c149780539629
|
@@ -1,5 +1,6 @@
|
|
1
1
|
// User-defined variables
|
2
2
|
@import "trestle/support";
|
3
|
+
@import "auth/defaults";
|
3
4
|
|
4
5
|
// 3rd party dependencies
|
5
6
|
@import "trestle/bootstrap";
|
@@ -7,3 +8,6 @@
|
|
7
8
|
|
8
9
|
@import "auth/layout";
|
9
10
|
@import "auth/form";
|
11
|
+
|
12
|
+
// User customizations
|
13
|
+
@import "trestle/custom-auth";
|
@@ -0,0 +1,13 @@
|
|
1
|
+
$auth-bg: $theme-bg !default;
|
2
|
+
|
3
|
+
$auth-form-control-color: white !default;
|
4
|
+
$auth-form-control-placeholder: rgba(white, 0.5) !default;
|
5
|
+
$auth-form-control-bg: rgba(white, 0.1) !default;
|
6
|
+
$auth-form-control-border: 0 !default;
|
7
|
+
|
8
|
+
$auth-remember-me-color: rgba(white, 0.75) !default;
|
9
|
+
$auth-remember-me-bg: rgba(black, 0.075) !default;
|
10
|
+
|
11
|
+
$auth-login-btn-color: $btn-primary-color !default;
|
12
|
+
$auth-login-btn-border: $btn-primary-border !default;
|
13
|
+
$auth-login-btn-bg: $btn-primary-bg !default;
|
@@ -12,34 +12,15 @@ a {
|
|
12
12
|
}
|
13
13
|
}
|
14
14
|
|
15
|
-
.remember-me {
|
16
|
-
display: block;
|
17
|
-
font-weight: normal;
|
18
|
-
color: rgba(white, 0.75);
|
19
|
-
background: rgba(black, 0.075);
|
20
|
-
border-radius: 5px;
|
21
|
-
padding: 10px 15px;
|
22
|
-
font-size: 13px;
|
23
|
-
cursor: pointer;
|
24
|
-
|
25
|
-
input {
|
26
|
-
margin-right: 10px;
|
27
|
-
}
|
28
|
-
|
29
|
-
&:hover {
|
30
|
-
background: rgba(black, 0.1);
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
15
|
.form-control, .input-group-addon {
|
35
|
-
background:
|
36
|
-
border:
|
16
|
+
background: $auth-form-control-bg;
|
17
|
+
border: $auth-form-control-border;
|
37
18
|
}
|
38
19
|
|
39
20
|
.form-control {
|
40
21
|
box-shadow: none;
|
41
22
|
|
42
|
-
color:
|
23
|
+
color: $auth-form-control-color;
|
43
24
|
|
44
25
|
height: auto;
|
45
26
|
padding: 12px 5px;
|
@@ -53,11 +34,11 @@ a {
|
|
53
34
|
}
|
54
35
|
|
55
36
|
&::placeholder {
|
56
|
-
color:
|
37
|
+
color: $auth-form-control-placeholder;
|
57
38
|
}
|
58
39
|
|
59
40
|
&:-webkit-autofill {
|
60
|
-
-webkit-text-fill-color:
|
41
|
+
-webkit-text-fill-color: $auth-form-control-color;
|
61
42
|
|
62
43
|
&, &:hover, &:focus, &:active {
|
63
44
|
transition: background-color 9999999s ease-in-out 0s;
|
@@ -73,6 +54,27 @@ a {
|
|
73
54
|
}
|
74
55
|
}
|
75
56
|
|
57
|
+
.remember-me {
|
58
|
+
display: block;
|
59
|
+
font-weight: normal;
|
60
|
+
color: $auth-remember-me-color;
|
61
|
+
background: $auth-remember-me-bg;
|
62
|
+
border-radius: 5px;
|
63
|
+
padding: 10px 15px;
|
64
|
+
font-size: 13px;
|
65
|
+
cursor: pointer;
|
66
|
+
|
67
|
+
input {
|
68
|
+
margin-right: 10px;
|
69
|
+
margin-top: 0;
|
70
|
+
vertical-align: middle;
|
71
|
+
}
|
72
|
+
|
73
|
+
&:hover {
|
74
|
+
background: opacify($auth-remember-me-bg, 0.05);
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
76
78
|
.btn {
|
77
79
|
box-shadow: rgba(black, 0.1) 0 0 2px;
|
78
80
|
padding: 12px;
|
@@ -82,20 +84,24 @@ a {
|
|
82
84
|
.btn-primary {
|
83
85
|
outline: none;
|
84
86
|
|
87
|
+
color: $auth-login-btn-color;
|
88
|
+
background: $auth-login-btn-bg;
|
89
|
+
border: $auth-login-btn-border;
|
90
|
+
|
85
91
|
&:hover {
|
86
|
-
background-color: darken($btn-
|
87
|
-
border-color: darken($btn-
|
92
|
+
background-color: darken($auth-login-btn-bg, 2.5%);
|
93
|
+
border-color: darken($auth-login-btn-border, 5%);
|
88
94
|
}
|
89
95
|
|
90
96
|
&:focus, &:active {
|
91
|
-
background-color: darken($btn-
|
92
|
-
border-color: darken($btn-
|
97
|
+
background-color: darken($auth-login-btn-bg, 5%);
|
98
|
+
border-color: darken($auth-login-btn-border, 10%);
|
93
99
|
}
|
94
100
|
|
95
101
|
&:active:focus {
|
96
102
|
outline: none !important;
|
97
|
-
background-color: darken($btn-
|
98
|
-
border-color: darken($btn-
|
103
|
+
background-color: darken($auth-login-btn-bg, 10%);
|
104
|
+
border-color: darken($auth-login-btn-border, 15%);
|
99
105
|
}
|
100
106
|
}
|
101
107
|
|
data/config/locale/en.yml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
en:
|
2
2
|
admin:
|
3
3
|
auth:
|
4
|
-
my_account: My Account
|
5
|
-
login: Login
|
6
|
-
logout: Logout
|
7
|
-
error: Incorrect login details.
|
8
|
-
remember_me: Remember me
|
4
|
+
my_account: "My Account"
|
5
|
+
login: "Login"
|
6
|
+
logout: "Logout"
|
7
|
+
error: "Incorrect login details."
|
8
|
+
remember_me: "Remember me"
|
@@ -51,6 +51,13 @@ module Trestle
|
|
51
51
|
# user.locale if user.respond_to?(:locale)
|
52
52
|
# }
|
53
53
|
|
54
|
+
# Customize the method for determining the user's time zone.
|
55
|
+
# Defaults to user.time_zone (if the method is defined).
|
56
|
+
#
|
57
|
+
# config.auth.time_zone = ->(user) {
|
58
|
+
# user.time_zone if user.respond_to?(:time_zone)
|
59
|
+
# }
|
60
|
+
|
54
61
|
# Enable or disable remember me functionality. Defaults to true.
|
55
62
|
#
|
56
63
|
# config.auth.remember.enabled = false
|
@@ -65,6 +72,12 @@ module Trestle
|
|
65
72
|
# User.authenticate_with_remember_token(token)
|
66
73
|
# }
|
67
74
|
|
75
|
+
# Customize the method for finding a user given an ID from the session.
|
76
|
+
#
|
77
|
+
# config.auth.remember.find_user = ->(id) {
|
78
|
+
# User.find_by(id: id)
|
79
|
+
# }
|
80
|
+
|
68
81
|
# Customize the method for remembering a user.
|
69
82
|
#
|
70
83
|
# config.auth.remember.remember_me, ->(user) { user.remember_me! }
|
data/lib/trestle/auth.rb
CHANGED
@@ -7,7 +7,9 @@ module Trestle
|
|
7
7
|
helper_method :current_user, :logged_in?
|
8
8
|
|
9
9
|
before_action :require_authenticated_user
|
10
|
-
|
10
|
+
|
11
|
+
around_action :set_locale, if: :logged_in?
|
12
|
+
around_action :set_time_zone, if: :logged_in?
|
11
13
|
end
|
12
14
|
|
13
15
|
protected
|
@@ -69,10 +71,11 @@ module Trestle
|
|
69
71
|
end
|
70
72
|
|
71
73
|
def set_locale
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
74
|
+
I18n.with_locale(Trestle.config.auth.locale(current_user) || I18n.default_locale) { yield }
|
75
|
+
end
|
76
|
+
|
77
|
+
def set_time_zone
|
78
|
+
Time.use_zone(Trestle.config.auth.time_zone(current_user) || Rails.application.config.time_zone) { yield }
|
76
79
|
end
|
77
80
|
end
|
78
81
|
end
|
data/lib/trestle/auth/version.rb
CHANGED
data/trestle-auth.gemspec
CHANGED
@@ -11,7 +11,6 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.email = ["sam@sampohlenz.com"]
|
12
12
|
|
13
13
|
spec.summary = "Authentication plugin for the Trestle admin framework"
|
14
|
-
spec.description = "Authentication plugin for the Trestle admin framework."
|
15
14
|
spec.homepage = "https://www.trestle.io"
|
16
15
|
spec.license = "LGPL-3.0"
|
17
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trestle-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Pohlenz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trestle
|
@@ -80,7 +80,7 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.0'
|
83
|
-
description:
|
83
|
+
description:
|
84
84
|
email:
|
85
85
|
- sam@sampohlenz.com
|
86
86
|
executables: []
|
@@ -95,7 +95,9 @@ files:
|
|
95
95
|
- README.md
|
96
96
|
- Rakefile
|
97
97
|
- app/assets/javascripts/trestle/auth.js
|
98
|
+
- app/assets/stylesheets/trestle/_custom-auth.scss
|
98
99
|
- app/assets/stylesheets/trestle/auth.scss
|
100
|
+
- app/assets/stylesheets/trestle/auth/_defaults.scss
|
99
101
|
- app/assets/stylesheets/trestle/auth/_form.scss
|
100
102
|
- app/assets/stylesheets/trestle/auth/_layout.scss
|
101
103
|
- app/assets/stylesheets/trestle/auth/userbox.scss
|
@@ -106,6 +108,8 @@ files:
|
|
106
108
|
- app/views/trestle/auth/sessions/new.html.erb
|
107
109
|
- config/initializers/trestle.rb
|
108
110
|
- config/locale/en.yml
|
111
|
+
- config/locale/pl.yml
|
112
|
+
- config/locale/pt-BR.yml
|
109
113
|
- config/routes.rb
|
110
114
|
- lib/generators/trestle/auth/admin/admin_generator.rb
|
111
115
|
- lib/generators/trestle/auth/admin/templates/admin.rb.erb
|
@@ -114,6 +118,7 @@ files:
|
|
114
118
|
- lib/trestle/auth.rb
|
115
119
|
- lib/trestle/auth/configuration.rb
|
116
120
|
- lib/trestle/auth/configuration/rememberable.rb
|
121
|
+
- lib/trestle/auth/constraint.rb
|
117
122
|
- lib/trestle/auth/controller_methods.rb
|
118
123
|
- lib/trestle/auth/engine.rb
|
119
124
|
- lib/trestle/auth/model_methods.rb
|
@@ -141,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
146
|
version: '0'
|
142
147
|
requirements: []
|
143
148
|
rubyforge_project:
|
144
|
-
rubygems_version: 2.
|
149
|
+
rubygems_version: 2.7.3
|
145
150
|
signing_key:
|
146
151
|
specification_version: 4
|
147
152
|
summary: Authentication plugin for the Trestle admin framework
|