trestle-auth 0.2.5 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.browserslistrc +2 -0
- data/.gitignore +1 -0
- data/app/assets/bundle/trestle/auth/bundle.css +1 -0
- data/app/assets/bundle/trestle/auth/userbox.css +1 -0
- data/app/assets/stylesheets/trestle/_custom-auth.css +6 -0
- data/app/assets/stylesheets/trestle/auth.css +2 -0
- data/app/helpers/trestle/auth/title_helper.rb +3 -1
- data/app/views/layouts/trestle/auth.html.erb +11 -8
- data/app/views/trestle/auth/_userbox.html.erb +3 -4
- data/app/views/trestle/auth/sessions/new.html.erb +17 -9
- data/config/{locale → locales}/en.yml +0 -0
- data/config/locales/es.yml +8 -0
- data/config/{locale → locales}/pl.yml +0 -0
- data/config/{locale → locales}/pt-BR.yml +0 -0
- data/config/{locale → locales}/zh-CN.yml +0 -0
- data/frontend/_form.scss +79 -0
- data/frontend/_layout.scss +35 -0
- data/{app/assets/stylesheets/trestle/auth/_defaults.scss → frontend/_variables.scss} +2 -6
- data/frontend/index.scss +5 -0
- data/{app/assets/stylesheets/trestle/auth → frontend}/userbox.scss +10 -12
- data/lib/generators/trestle/auth/install/install_generator.rb +6 -0
- data/lib/trestle/auth/configuration.rb +2 -0
- data/lib/trestle/auth/engine.rb +1 -1
- data/lib/trestle/auth/version.rb +1 -1
- data/package.json +29 -0
- data/trestle-auth.gemspec +2 -2
- data/webpack.config.js +49 -0
- data/yarn.lock +4957 -0
- metadata +23 -17
- data/app/assets/javascripts/trestle/auth.js +0 -0
- data/app/assets/stylesheets/trestle/_custom-auth.scss +0 -4
- data/app/assets/stylesheets/trestle/auth.scss +0 -13
- data/app/assets/stylesheets/trestle/auth/_form.scss +0 -138
- data/app/assets/stylesheets/trestle/auth/_layout.scss +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c66ad14a57d22f21b9e9b170a48a505060704b557c0abde4e56526f1b7d95561
|
4
|
+
data.tar.gz: b8d449820f15f9923724d58650f965715cf420073d52d52d4353e20f6de14068
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d58fe42ceab549559ffa679ef6e028695c27d815e4958278300a0de0ff943ff0f8480519e3bfd1cd59fac6e3763afdfa3829dc31c8d6475018f7ef8c21d4e738
|
7
|
+
data.tar.gz: af0149b4c92cad0b37bf42f82369507a2d3a57c46a8ed116ef2781965a7b837688c7a7fd0c50fd0087493b39b74266d0ba062a2e25c700747c47b4730591a835
|
data/.browserslistrc
ADDED
data/.gitignore
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
.auth-body{display:-webkit-box;display:flex;color:#fff}.auth-body .container{margin:auto;width:320px}.auth-header{text-align:center;margin-bottom:20px}.auth-header h1{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;font-size:1.75rem;font-weight:500;text-shadow:rgba(0,0,0,.5) 0 1px 1px;padding:.75rem 1rem}.auth-header img{max-width:80%;max-height:100%}.auth-header span{margin-left:10px}.login-form .form-control,.login-form .input-group-text{background:hsla(0,0%,100%,.1);border:0}.login-form .form-control{color:#fff;font-size:1.1rem;padding:1.75rem .75rem}.login-form .form-control:focus{outline-color:transparent;outline-style:none;box-shadow:none}.login-form .form-control::-webkit-input-placeholder{color:hsla(0,0%,100%,.5)}.login-form .form-control::-moz-placeholder{color:hsla(0,0%,100%,.5)}.login-form .form-control:-ms-input-placeholder{color:hsla(0,0%,100%,.5)}.login-form .form-control::-ms-input-placeholder{color:hsla(0,0%,100%,.5)}.login-form .form-control::placeholder{color:hsla(0,0%,100%,.5)}.login-form .form-control:-webkit-autofill{-webkit-text-fill-color:#fff}.login-form .form-control:-webkit-autofill,.login-form .form-control:-webkit-autofill:active,.login-form .form-control:-webkit-autofill:focus,.login-form .form-control:-webkit-autofill:hover{-webkit-transition:background-color 9999999s ease-in-out 0s;transition:background-color 9999999s ease-in-out 0s}.login-form .input-group-prepend{margin-right:0}.login-form .input-group-text{color:hsla(0,0%,100%,.5);padding:.375rem .25rem .375rem 1rem}.login-form .btn-primary{box-shadow:0 0 2px rgba(0,0,0,.1);padding-top:.75rem;padding-bottom:.75rem}.login-form .alert-danger{background-color:rgba(222,116,113,.75)}.login-form .remember-me{font-size:.95rem;line-height:1.5;padding-left:0}.login-form .remember-me .custom-control-label{display:block;cursor:pointer;background:rgba(0,0,0,.075);color:hsla(0,0%,100%,.75);border-radius:.25rem;padding:.75em 1.5em .75em 3.25em}.login-form .remember-me .custom-control-label:hover{background:rgba(0,0,0,.125)}.login-form .remember-me .custom-control-label:after,.login-form .remember-me .custom-control-label:before{top:.925em;left:1.1em}
|
@@ -0,0 +1 @@
|
|
1
|
+
.userbox{-webkit-box-ordinal-group:100;order:99;padding:2px 0}.userbox>a{color:#333;display:block;padding:2px 0;font-weight:400;line-height:40px}.userbox>a:focus,.userbox>a:hover{text-decoration:none}.userbox .avatar{vertical-align:top;margin-left:6px}.userbox .dropdown-toggle:after{vertical-align:middle}@media (max-width:767.98px){.userbox{display:block;position:relative;z-index:5}.userbox .name{display:none}.userbox .avatar{border:1px solid hsla(0,0%,100%,.25)}}
|
@@ -2,7 +2,9 @@ module Trestle
|
|
2
2
|
module Auth
|
3
3
|
module TitleHelper
|
4
4
|
def trestle_auth_title
|
5
|
-
if Trestle.config.
|
5
|
+
if Trestle.config.auth.logo
|
6
|
+
image_tag(Trestle.config.auth.logo)
|
7
|
+
elsif Trestle.config.site_logo
|
6
8
|
image_tag(Trestle.config.site_logo)
|
7
9
|
elsif Trestle.config.site_logo_small
|
8
10
|
safe_join([
|
@@ -5,24 +5,27 @@
|
|
5
5
|
<meta content='width=device-width, initial-scale=1' name='viewport'>
|
6
6
|
<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>
|
7
7
|
|
8
|
-
|
8
|
+
<% if Trestle.config.turbolinks %>
|
9
|
+
<meta content='no-cache' name='turbolinks-cache-control'>
|
10
|
+
<% end %>
|
9
11
|
|
10
12
|
<%= csrf_meta_tags %>
|
11
13
|
|
12
14
|
<title><%= Trestle.config.site_title %></title>
|
13
15
|
|
16
|
+
<%= stylesheet_link_tag "trestle/admin", 'data-turbolinks-track': 'reload' %>
|
17
|
+
<%= stylesheet_link_tag "trestle/theme", 'data-turbolinks-track': 'reload' if Trestle.config.theme %>
|
18
|
+
<%= stylesheet_link_tag "trestle/custom", 'data-turbolinks-track': 'reload' %>
|
19
|
+
|
14
20
|
<%= stylesheet_link_tag "trestle/auth", 'data-turbolinks-track': 'reload' %>
|
15
21
|
|
16
|
-
<%= javascript_include_tag "turbolinks" if
|
17
|
-
|
22
|
+
<%= javascript_include_tag "turbolinks" if Trestle.config.turbolinks %>
|
23
|
+
|
24
|
+
<%= hook "auth.head" %>
|
18
25
|
</head>
|
19
26
|
|
20
|
-
<body>
|
27
|
+
<body class="auth-body theme-bg-dark">
|
21
28
|
<main class="container">
|
22
|
-
<header class="auth-header">
|
23
|
-
<h1><%= trestle_auth_title %></h1>
|
24
|
-
</header>
|
25
|
-
|
26
29
|
<%= yield %>
|
27
30
|
</main>
|
28
31
|
</body>
|
@@ -1,8 +1,7 @@
|
|
1
|
-
<div class="userbox
|
2
|
-
<%= link_to "#",
|
3
|
-
<span class="name">
|
1
|
+
<div class="userbox dropdown">
|
2
|
+
<%= link_to "#", data: { toggle: 'dropdown' } do %>
|
3
|
+
<span class="name dropdown-toggle">
|
4
4
|
<%= format_user_name(current_user) %>
|
5
|
-
<span class="caret"></span>
|
6
5
|
</span>
|
7
6
|
|
8
7
|
<%= avatar_for(current_user) %>
|
@@ -1,22 +1,30 @@
|
|
1
1
|
<%= form_tag login_path, class: "login-form" do %>
|
2
|
-
|
2
|
+
<header class="auth-header">
|
3
|
+
<%= hook("auth.login.heading") do %>
|
4
|
+
<h1><%= trestle_auth_title %></h1>
|
5
|
+
<% end %>
|
6
|
+
</header>
|
3
7
|
|
4
8
|
<% if flash[:error] -%>
|
5
|
-
<div class="alert alert-danger">
|
9
|
+
<div class="alert alert-danger error-bg">
|
6
10
|
<p><%= flash[:error] %></p>
|
7
11
|
</div>
|
8
12
|
<% end -%>
|
9
13
|
|
10
14
|
<div class="form-group">
|
11
15
|
<div class="input-group">
|
12
|
-
<
|
16
|
+
<div class="input-group-prepend">
|
17
|
+
<span class="input-group-text"><i class="fa fa-user fa-fw"></i></span>
|
18
|
+
</div>
|
13
19
|
<%= text_field_tag Trestle.config.auth.authenticate_with, "", placeholder: Trestle.config.auth.authenticate_with.to_s.humanize, class: "form-control" %>
|
14
20
|
</div>
|
15
21
|
</div>
|
16
22
|
|
17
23
|
<div class="form-group">
|
18
24
|
<div class="input-group">
|
19
|
-
<
|
25
|
+
<div class="input-group-prepend">
|
26
|
+
<span class="input-group-text"><i class="fa fa-lock fa-fw"></i></span>
|
27
|
+
</div>
|
20
28
|
<%= password_field_tag :password, "", placeholder: "Password", class: "form-control" %>
|
21
29
|
</div>
|
22
30
|
</div>
|
@@ -25,14 +33,14 @@
|
|
25
33
|
|
26
34
|
<% if Trestle.config.auth.remember.enabled %>
|
27
35
|
<div class="form-group">
|
28
|
-
<
|
29
|
-
<%= check_box_tag :remember_me %>
|
30
|
-
<%= t("admin.auth.remember_me", default: "Remember me") %>
|
31
|
-
</
|
36
|
+
<div class="custom-control custom-checkbox remember-me">
|
37
|
+
<%= check_box_tag :remember_me, "1", false, class: "custom-control-input" %>
|
38
|
+
<%= label_tag :remember_me, t("admin.auth.remember_me", default: "Remember me"), class: "custom-control-label" %>
|
39
|
+
</div>
|
32
40
|
</div>
|
33
41
|
<% end %>
|
34
42
|
|
35
43
|
<div class="form-group">
|
36
|
-
<%= submit_tag t("admin.auth.login", default: "Login"), class: "btn btn-primary btn-block" %>
|
44
|
+
<%= submit_tag t("admin.auth.login", default: "Login"), class: "btn btn-primary btn-block btn-lg" %>
|
37
45
|
</div>
|
38
46
|
<% end %>
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/frontend/_form.scss
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
.login-form {
|
2
|
+
.form-control, .input-group-text {
|
3
|
+
background: $auth-form-control-bg;
|
4
|
+
border: $auth-form-control-border;
|
5
|
+
}
|
6
|
+
|
7
|
+
.form-control {
|
8
|
+
color: $auth-form-control-color;
|
9
|
+
font-size: 1.1rem;
|
10
|
+
|
11
|
+
padding: 1.75rem 0.75rem;
|
12
|
+
|
13
|
+
&:focus {
|
14
|
+
outline-color: transparent;
|
15
|
+
outline-style: none;
|
16
|
+
box-shadow: none;
|
17
|
+
}
|
18
|
+
|
19
|
+
&::placeholder {
|
20
|
+
color: $auth-form-control-placeholder;
|
21
|
+
}
|
22
|
+
|
23
|
+
&:-webkit-autofill {
|
24
|
+
-webkit-text-fill-color: $auth-form-control-color;
|
25
|
+
|
26
|
+
&, &:hover, &:focus, &:active {
|
27
|
+
transition: background-color 9999999s ease-in-out 0s;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
.input-group-prepend {
|
33
|
+
margin-right: 0;
|
34
|
+
}
|
35
|
+
|
36
|
+
.input-group-text {
|
37
|
+
color: $auth-form-control-icon-color;
|
38
|
+
padding: 0.375rem 0.25rem 0.375rem 1rem;
|
39
|
+
}
|
40
|
+
|
41
|
+
.btn-primary {
|
42
|
+
box-shadow: rgba(black, 0.1) 0 0 2px;
|
43
|
+
|
44
|
+
padding-top: 0.75rem;
|
45
|
+
padding-bottom: 0.75rem;
|
46
|
+
}
|
47
|
+
|
48
|
+
.alert-danger {
|
49
|
+
background-color: rgba($alert-danger-bg, 0.75);
|
50
|
+
}
|
51
|
+
|
52
|
+
.remember-me {
|
53
|
+
font-size: 0.95rem;
|
54
|
+
line-height: 1.5;
|
55
|
+
|
56
|
+
padding-left: 0;
|
57
|
+
|
58
|
+
.custom-control-label {
|
59
|
+
display: block;
|
60
|
+
cursor: pointer;
|
61
|
+
|
62
|
+
background: $auth-remember-me-bg;
|
63
|
+
color: $auth-remember-me-color;
|
64
|
+
|
65
|
+
border-radius: $border-radius;
|
66
|
+
padding: 0.75em 1.5em 0.75em 3.25em;
|
67
|
+
|
68
|
+
&:hover {
|
69
|
+
background: opacify($auth-remember-me-bg, 0.05);
|
70
|
+
}
|
71
|
+
|
72
|
+
&::before,
|
73
|
+
&::after {
|
74
|
+
top: 0.175em + 0.75em;
|
75
|
+
left: 1.1em;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
.auth-body {
|
2
|
+
display: flex;
|
3
|
+
color: white;
|
4
|
+
|
5
|
+
.container {
|
6
|
+
margin: auto;
|
7
|
+
width: 320px;
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
.auth-header {
|
12
|
+
text-align: center;
|
13
|
+
margin-bottom: 20px;
|
14
|
+
|
15
|
+
h1 {
|
16
|
+
display: flex;
|
17
|
+
align-items: center;
|
18
|
+
justify-content: center;
|
19
|
+
|
20
|
+
font-size: 1.75rem;
|
21
|
+
font-weight: 500;
|
22
|
+
text-shadow: rgba(black, 0.5) 0 1px 1px;
|
23
|
+
|
24
|
+
padding: 0.75rem 1rem;
|
25
|
+
}
|
26
|
+
|
27
|
+
img {
|
28
|
+
max-width: 80%;
|
29
|
+
max-height: 100%;
|
30
|
+
}
|
31
|
+
|
32
|
+
span {
|
33
|
+
margin-left: 10px;
|
34
|
+
}
|
35
|
+
}
|
@@ -1,13 +1,9 @@
|
|
1
|
-
$auth-bg: $theme-bg !default;
|
2
|
-
|
3
1
|
$auth-form-control-color: white !default;
|
4
2
|
$auth-form-control-placeholder: rgba(white, 0.5) !default;
|
5
3
|
$auth-form-control-bg: rgba(white, 0.1) !default;
|
6
4
|
$auth-form-control-border: 0 !default;
|
7
5
|
|
6
|
+
$auth-form-control-icon-color: rgba(white, 0.5) !default;
|
7
|
+
|
8
8
|
$auth-remember-me-color: rgba(white, 0.75) !default;
|
9
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;
|
data/frontend/index.scss
ADDED
@@ -1,16 +1,15 @@
|
|
1
|
-
@import "trestle/support";
|
1
|
+
@import "~trestle/frontend/css/support";
|
2
2
|
|
3
3
|
.userbox {
|
4
|
-
|
5
|
-
|
4
|
+
order: 99;
|
5
|
+
padding: 2px 0;
|
6
6
|
|
7
7
|
> a {
|
8
|
-
color: $
|
8
|
+
color: $body-color;
|
9
9
|
|
10
10
|
display: block;
|
11
11
|
padding: 2px 0;
|
12
12
|
|
13
|
-
font-size: 14px;
|
14
13
|
font-weight: normal;
|
15
14
|
line-height: 40px;
|
16
15
|
|
@@ -24,20 +23,19 @@
|
|
24
23
|
margin-left: 6px;
|
25
24
|
}
|
26
25
|
|
27
|
-
.
|
28
|
-
|
26
|
+
.dropdown-toggle {
|
27
|
+
&::after {
|
28
|
+
vertical-align: middle;
|
29
|
+
}
|
29
30
|
}
|
30
31
|
}
|
31
32
|
|
32
|
-
@include
|
33
|
+
@include media-breakpoint-down(sm) {
|
33
34
|
.userbox {
|
35
|
+
display: block;
|
34
36
|
position: relative;
|
35
37
|
z-index: 5;
|
36
38
|
|
37
|
-
> a, .name {
|
38
|
-
color: white;
|
39
|
-
}
|
40
|
-
|
41
39
|
.name {
|
42
40
|
display: none;
|
43
41
|
}
|
@@ -97,6 +97,12 @@ module Trestle
|
|
97
97
|
#
|
98
98
|
# config.auth.redirect_on_logout = -> { "/" }
|
99
99
|
|
100
|
+
# Specify the logo used on the login form.
|
101
|
+
# If not specified, will fall back to config.site_logo,
|
102
|
+
# config.site_logo_small or config.site_title.
|
103
|
+
#
|
104
|
+
# config.auth.logo = "auth-logo.png"
|
105
|
+
|
100
106
|
# Enable or disable remember me functionality. Defaults to true.
|
101
107
|
#
|
102
108
|
# config.auth.remember.enabled = false
|
data/lib/trestle/auth/engine.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Trestle
|
2
2
|
module Auth
|
3
3
|
class Engine < ::Rails::Engine
|
4
|
-
config.assets.precompile << "trestle/auth.css" << "trestle/auth
|
4
|
+
config.assets.precompile << "trestle/auth.css" << "trestle/auth/userbox.css"
|
5
5
|
|
6
6
|
config.before_initialize do
|
7
7
|
Trestle::Engine.paths["app/helpers"].concat(paths["app/helpers"].existent)
|
data/lib/trestle/auth/version.rb
CHANGED
data/package.json
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
{
|
2
|
+
"name": "trestle-auth",
|
3
|
+
"version": "0.3.0",
|
4
|
+
"description": "Authentication plugin for the Trestle admin framework",
|
5
|
+
"repository": "https://github.com/TrestleAdmin/trestle-auth.git",
|
6
|
+
"author": "Sam Pohlenz <sam@sampohlenz.com>",
|
7
|
+
"license": "LGPL-3.0",
|
8
|
+
"private": true,
|
9
|
+
"scripts": {
|
10
|
+
"dev": "webpack --mode development",
|
11
|
+
"build": "webpack --mode production",
|
12
|
+
"watch": "webpack --mode development --watch"
|
13
|
+
},
|
14
|
+
"dependencies": {
|
15
|
+
"trestle": "https://github.com/TrestleAdmin/trestle.git"
|
16
|
+
},
|
17
|
+
"devDependencies": {
|
18
|
+
"autoprefixer": "^9.6.1",
|
19
|
+
"css-loader": "^3.2.0",
|
20
|
+
"mini-css-extract-plugin": "^0.8.0",
|
21
|
+
"node-sass": "^4.12.0",
|
22
|
+
"optimize-css-assets-webpack-plugin": "^5.0.3",
|
23
|
+
"postcss-loader": "^3.0.0",
|
24
|
+
"sass-loader": "^8.0.0",
|
25
|
+
"webpack": "^4.40.2",
|
26
|
+
"webpack-cli": "^3.3.9",
|
27
|
+
"webpack-fix-style-only-entries": "^0.4.0"
|
28
|
+
}
|
29
|
+
}
|
data/trestle-auth.gemspec
CHANGED
@@ -14,10 +14,10 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = "https://www.trestle.io"
|
15
15
|
spec.license = "LGPL-3.0"
|
16
16
|
|
17
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|node_modules)/}) }
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_dependency "trestle", "~> 0.
|
20
|
+
spec.add_dependency "trestle", "~> 0.9.0"
|
21
21
|
spec.add_dependency "bcrypt", "~> 3.1.7"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.12"
|