trestle-auth 0.2.5 → 0.4.3

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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.browserslistrc +1 -0
  3. data/.gitignore +5 -0
  4. data/.rspec +1 -0
  5. data/.travis.yml +20 -3
  6. data/Gemfile +14 -0
  7. data/README.md +34 -7
  8. data/app/assets/bundle/trestle/auth/bundle.css +1 -0
  9. data/app/assets/bundle/trestle/auth/userbox.css +1 -0
  10. data/app/assets/stylesheets/trestle/_custom-auth.css +6 -0
  11. data/app/assets/stylesheets/trestle/auth.css +2 -0
  12. data/app/controllers/trestle/auth/sessions_controller.rb +3 -4
  13. data/app/helpers/trestle/auth/title_helper.rb +3 -1
  14. data/app/views/layouts/trestle/auth.html.erb +11 -8
  15. data/app/views/trestle/auth/_userbox.html.erb +16 -5
  16. data/app/views/trestle/auth/sessions/_form.html.erb +32 -0
  17. data/app/views/trestle/auth/sessions/new.html.erb +8 -31
  18. data/bin/rails +20 -0
  19. data/config/{locale → locales}/en.yml +7 -0
  20. data/config/locales/es.yml +15 -0
  21. data/config/{locale → locales}/pl.yml +7 -0
  22. data/config/{locale → locales}/pt-BR.yml +7 -0
  23. data/config/{locale → locales}/zh-CN.yml +0 -0
  24. data/config/routes.rb +8 -3
  25. data/frontend/_form.scss +79 -0
  26. data/frontend/_layout.scss +35 -0
  27. data/{app/assets/stylesheets/trestle/auth/_defaults.scss → frontend/_variables.scss} +2 -6
  28. data/frontend/index.scss +5 -0
  29. data/{app/assets/stylesheets/trestle/auth → frontend}/userbox.scss +14 -12
  30. data/gemfiles/rails-4.2.gemfile +18 -0
  31. data/gemfiles/rails-5.0.gemfile +18 -0
  32. data/gemfiles/rails-5.1.gemfile +18 -0
  33. data/gemfiles/rails-5.2.gemfile +18 -0
  34. data/gemfiles/rails-6.0.gemfile +18 -0
  35. data/lib/generators/trestle/auth/account/account_generator.rb +32 -0
  36. data/lib/generators/trestle/auth/account/templates/admin.rb.erb +47 -0
  37. data/lib/generators/trestle/auth/admin/admin_generator.rb +15 -1
  38. data/lib/generators/trestle/auth/admin/templates/admin.rb.erb +28 -5
  39. data/lib/generators/trestle/auth/install/install_generator.rb +40 -109
  40. data/lib/generators/trestle/auth/install/templates/basic.rb.erb +121 -0
  41. data/lib/generators/trestle/auth/install/templates/devise.rb.erb +92 -0
  42. data/lib/trestle/auth.rb +14 -8
  43. data/lib/trestle/auth/backends.rb +34 -0
  44. data/lib/trestle/auth/backends/base.rb +28 -0
  45. data/lib/trestle/auth/backends/basic.rb +72 -0
  46. data/lib/trestle/auth/backends/devise.rb +14 -0
  47. data/lib/trestle/auth/backends/warden.rb +53 -0
  48. data/lib/trestle/auth/configuration.rb +27 -3
  49. data/lib/trestle/auth/configuration/warden.rb +11 -0
  50. data/lib/trestle/auth/constraint.rb +23 -1
  51. data/lib/trestle/auth/controller/authentication.rb +58 -0
  52. data/lib/trestle/auth/controller/locale.rb +18 -0
  53. data/lib/trestle/auth/controller/time_zone.rb +18 -0
  54. data/lib/trestle/auth/controller_methods.rb +3 -74
  55. data/lib/trestle/auth/engine.rb +1 -1
  56. data/lib/trestle/auth/model_methods.rb +2 -3
  57. data/lib/trestle/auth/version.rb +1 -1
  58. data/package.json +29 -0
  59. data/trestle-auth.gemspec +14 -10
  60. data/webpack.config.js +49 -0
  61. data/yarn.lock +4835 -0
  62. metadata +66 -32
  63. data/app/assets/javascripts/trestle/auth.js +0 -0
  64. data/app/assets/stylesheets/trestle/_custom-auth.scss +0 -4
  65. data/app/assets/stylesheets/trestle/auth.scss +0 -13
  66. data/app/assets/stylesheets/trestle/auth/_form.scss +0 -138
  67. 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: 8ef9ad52449a79a688c9ee2a6e7b86c35179b4c0bad12390f69cb31cf25704ff
4
- data.tar.gz: 30f3172c89781a4baa176f1dffa233efbb1060a7cf5171aa93339b7aa27d1d3f
3
+ metadata.gz: b08d828b994e12b0bad65b7beb577501294a3f531755e068259a44b92241b9d3
4
+ data.tar.gz: 777c3c03a915bf990fdc24fffc950e920f4fff9c0832ec4aa3f5a48468615174
5
5
  SHA512:
6
- metadata.gz: c51b04bb59d56bf4e65f268944fb1b1f0e92001ad83115f630a24381bc70f7474491456126bfffad1372612150d75481dd98bb46cbc2e200116efb4cc1983c89
7
- data.tar.gz: f5dfe2f6cf6298d8b8ff39be723498951d40a77f53671e4845a85c23c7bfddc09f27ff21fdf06e583f33e8254d9f9c3e37faa33b873e2af732e91be0df776b06
6
+ metadata.gz: 3043e2d73c00181ce0d4b88eb6269e0ccb2bfc0ec52c21b9a335b280aceeac03abcd67703c7763f7ddbe06f04f11ff87970607fad7ddf6677ae401d242ff2061
7
+ data.tar.gz: 456ac4bf79afb1c5dcda966351387f1bb007bfac0e0d717ecb3478619d0936bdd8851cccccf740cb3e039c78f1f1b85fca32c42a172e80a65dcb7049f4f5fe34
data/.browserslistrc ADDED
@@ -0,0 +1 @@
1
+ > 0.25%
data/.gitignore CHANGED
@@ -7,3 +7,8 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /node_modules/
11
+ /spec/dummy/db/*.sqlite3
12
+ /spec/dummy/*.sqlite3-journal
13
+ /spec/dummy/log/*.log
14
+ /spec/dummy/tmp/*
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
+ --require spec_helper
1
2
  --format documentation
2
3
  --color
data/.travis.yml CHANGED
@@ -1,5 +1,22 @@
1
- sudo: false
2
1
  language: ruby
2
+
3
+ cache: bundler
4
+
5
+ before_install:
6
+ - gem update --system
7
+ - gem install bundler
8
+
3
9
  rvm:
4
- - 2.3.1
5
- before_install: gem install bundler -v 1.12.5
10
+ - 2.6.5
11
+
12
+ gemfile:
13
+ - gemfiles/rails-5.0.gemfile
14
+ - gemfiles/rails-5.1.gemfile
15
+ - gemfiles/rails-5.2.gemfile
16
+ - gemfiles/rails-6.0.gemfile
17
+
18
+ jobs:
19
+ include:
20
+ gemfile: gemfiles/rails-4.2.gemfile
21
+ before_install:
22
+ - gem install bundler -v '< 2'
data/Gemfile CHANGED
@@ -2,3 +2,17 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in trestle-auth.gemspec
4
4
  gemspec
5
+
6
+ group :test do
7
+ gem "coveralls", require: false
8
+
9
+ gem "capybara"
10
+ gem "sqlite3", "~> 1.4"
11
+ gem "devise"
12
+ end
13
+
14
+ gem "sassc-rails"
15
+
16
+ gem "rake", "~> 12.0"
17
+
18
+ gem "trestle", github: "TrestleAdmin/trestle"
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Trestle Authentication (trestle-auth)
2
2
 
3
+ [![RubyGem](https://img.shields.io/gem/v/trestle-auth.svg?style=flat&colorB=4065a9)](https://rubygems.org/gems/trestle-auth)
4
+ [![Travis](https://img.shields.io/travis/TrestleAdmin/trestle-auth.svg?style=flat)](https://travis-ci.org/TrestleAdmin/trestle-auth)
5
+ [![Coveralls](https://img.shields.io/coveralls/TrestleAdmin/trestle-auth.svg?style=flat)](https://coveralls.io/github/TrestleAdmin/trestle-auth)
6
+
3
7
  > Authentication plugin for the Trestle admin framework
4
8
 
5
9
  <img src="https://trestle.io/images/Trestle-Auth-1.png" width="50%" /><img src="https://trestle.io/images/Trestle-Auth-2.png" width="50%" />
@@ -7,25 +11,48 @@
7
11
 
8
12
  ## Getting Started
9
13
 
10
- These instructions assume you have a working Trestle application. To integrate trestle-auth, first add it to your application's Gemfile:
14
+ These instructions assume you have a working Trestle application. See the [Getting Started](https://github.com/TrestleAdmin/trestle#getting-started) section in the Trestle README.
15
+
16
+ To integrate trestle-auth, first add it to your application's Gemfile, and then run `bundle install`:
11
17
 
12
18
  ```ruby
13
19
  gem 'trestle-auth'
14
20
  ```
15
21
 
16
- Run `bundle install`, and then run the install generator to set up configuration options, user model and user admin resource.
22
+ As of version 0.4.0, trestle-auth now supports multiple authentication backends including Devise/Warden.
23
+
24
+
25
+ ### Option 1: Built-in Integration
17
26
 
18
- $ rails generate trestle:auth:install
19
- $ rake db:migrate
27
+ Run the install generator to add the configuration to `config/initializers/trestle.rb`, and generate a `User` model and admin resource.
20
28
 
21
- Then create an initial admin user from the rails console:
29
+ $ rails generate trestle:auth:install User
22
30
 
23
- $ rails console
24
- > Administrator.create(email: "admin@example.com", password: "password", first_name: "Admin", last_name: "User")
31
+ (if no user model name is specified it will default to `Administrator`)
32
+
33
+ Then run your migrations with `rake db:migrate` and create an initial admin user from within `rails console`:
34
+
35
+ ```ruby
36
+ User.create(email: "admin@example.com", password: "password", first_name: "Admin", last_name: "User")
37
+ ```
25
38
 
26
39
  After restarting your Rails server, any attempt to access a page within your admin will redirect you to the login page.
27
40
 
28
41
 
42
+ ### Option 2: Devise Integration
43
+
44
+ If you already have an existing user model and Devise integration, you can configure trestle-auth to use that instead.
45
+
46
+ $ rails generate trestle:auth:install User --devise
47
+
48
+ Replace `User` with the name of your Devise user model. If not specified, it will default to `Administrator`.
49
+
50
+
51
+ ## Configuration
52
+
53
+ After running the `trestle:auth:install` generator, check your `config/initializers/trestle.rb` for further configuration options.
54
+
55
+
29
56
  ## License
30
57
 
31
58
  The gem is available as open source under the terms of the [LGPLv3 License](https://opensource.org/licenses/LGPL-3.0).
@@ -0,0 +1 @@
1
+ .auth-body{display:flex;color:#fff}.auth-body .container{margin:auto;width:320px}.auth-header{text-align:center;margin-bottom:20px}.auth-header h1{display:flex;align-items: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:-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{order:99;padding:2px 0;display:flex;align-items:center}.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);margin-left:0}}
@@ -0,0 +1,6 @@
1
+ /*
2
+ * This file is left as an extension point for user customization.
3
+ *
4
+ * It will be overridden by the similarly named file within
5
+ * the app/assets folder of the Rails application.
6
+ */
@@ -0,0 +1,2 @@
1
+ //= require trestle/auth/bundle
2
+ //= require trestle/_custom-auth
@@ -1,16 +1,15 @@
1
1
  class Trestle::Auth::SessionsController < Trestle::ApplicationController
2
2
  layout 'trestle/auth'
3
3
 
4
+ skip_before_action :authenticate_user, only: [:new, :create]
4
5
  skip_before_action :require_authenticated_user
5
6
 
6
7
  def new
7
8
  end
8
9
 
9
10
  def create
10
- if user = Trestle.config.auth.authenticate(params)
11
- login!(user)
12
- remember_me! if params[:remember_me] == "1"
13
- redirect_to previous_location || instance_exec(&Trestle.config.auth.redirect_on_login)
11
+ if authentication_backend.authenticate!
12
+ redirect_to authentication_backend.previous_location || instance_exec(&Trestle.config.auth.redirect_on_login)
14
13
  else
15
14
  flash[:error] = t("admin.auth.error", default: "Incorrect login details.")
16
15
  redirect_to action: :new
@@ -2,7 +2,9 @@ module Trestle
2
2
  module Auth
3
3
  module TitleHelper
4
4
  def trestle_auth_title
5
- if Trestle.config.site_logo
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
- <meta content='no-cache' name='turbolinks-cache-control'>
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 defined?(Turbolinks) %>
17
- <%= javascript_include_tag "trestle/auth", 'data-turbolinks-track': 'reload' %>
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,17 +1,28 @@
1
- <div class="userbox pull-right dropdown">
2
- <%= link_to "#", class: 'dropdown-toggle', data: { toggle: 'dropdown' } do %>
3
- <span class="name">
1
+ <% show_dropdown = (Trestle.config.auth.user_admin && Trestle.lookup(Trestle.config.auth.user_admin)) || Trestle.config.auth.enable_logout %>
2
+
3
+ <div class="userbox<% if show_dropdown %> dropdown<% end %>">
4
+ <% content = capture do %>
5
+ <span class="name<% if show_dropdown %> dropdown-toggle<% end %>">
4
6
  <%= format_user_name(current_user) %>
5
- <span class="caret"></span>
6
7
  </span>
7
8
 
8
9
  <%= avatar_for(current_user) %>
9
10
  <% end %>
10
11
 
12
+ <% if show_dropdown %>
13
+ <%= link_to content, "#", data: { toggle: 'dropdown' } %>
14
+ <% else %>
15
+ <%= content %>
16
+ <% end %>
17
+
18
+ <% if show_dropdown -%>
11
19
  <ul class="dropdown-menu dropdown-menu-right">
12
20
  <% if Trestle.config.auth.user_admin && user_admin = Trestle.lookup(Trestle.config.auth.user_admin) -%>
13
21
  <li><%= admin_link_to t("admin.auth.my_account", default: "My Account"), current_user, admin: user_admin, class: "dropdown-item" %></li>
14
22
  <% end -%>
15
- <li><%= link_to t("admin.auth.logout", default: "Log out"), trestle.logout_path, class: "dropdown-item" %></li>
23
+ <% if Trestle.config.auth.enable_logout -%>
24
+ <li><%= link_to t("admin.auth.logout", default: "Log out"), trestle.logout_path, class: "dropdown-item" %></li>
25
+ <% end -%>
16
26
  </ul>
27
+ <% end %>
17
28
  </div>
@@ -0,0 +1,32 @@
1
+ <div class="form-group">
2
+ <div class="input-group">
3
+ <div class="input-group-prepend">
4
+ <span class="input-group-text"><i class="fa fa-user fa-fw"></i></span>
5
+ </div>
6
+ <%= f.text_field Trestle.config.auth.authenticate_with, placeholder: Trestle.config.auth.human_attribute_name(Trestle.config.auth.authenticate_with), class: "form-control" %>
7
+ </div>
8
+ </div>
9
+
10
+ <div class="form-group">
11
+ <div class="input-group">
12
+ <div class="input-group-prepend">
13
+ <span class="input-group-text"><i class="fa fa-lock fa-fw"></i></span>
14
+ </div>
15
+ <%= f.password_field :password, placeholder: Trestle.config.auth.human_attribute_name(:password), class: "form-control" %>
16
+ </div>
17
+ </div>
18
+
19
+ <%= hook("auth.login.form", f) %>
20
+
21
+ <% if Trestle.config.auth.remember.enabled %>
22
+ <div class="form-group">
23
+ <div class="custom-control custom-checkbox remember-me">
24
+ <%= f.check_box :remember_me, class: "custom-control-input", include_hidden: false %>
25
+ <%= f.label :remember_me, t("admin.auth.remember_me", default: "Remember me"), class: "custom-control-label" %>
26
+ </div>
27
+ </div>
28
+ <% end %>
29
+
30
+ <div class="form-group">
31
+ <%= f.submit t("admin.auth.login", default: "Login"), class: "btn btn-primary btn-block btn-lg" %>
32
+ </div>
@@ -1,38 +1,15 @@
1
- <%= form_tag login_path, class: "login-form" do %>
2
- <%= hook("auth.login.heading") %>
1
+ <%= form_for authentication_scope, url: login_path, html: { class: "login-form" } do |f| %>
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
- <div class="form-group">
11
- <div class="input-group">
12
- <span class="input-group-addon"><i class="fa fa-user fa-fw"></i></span>
13
- <%= text_field_tag Trestle.config.auth.authenticate_with, "", placeholder: Trestle.config.auth.authenticate_with.to_s.humanize, class: "form-control" %>
14
- </div>
15
- </div>
16
-
17
- <div class="form-group">
18
- <div class="input-group">
19
- <span class="input-group-addon"><i class="fa fa-lock fa-fw"></i></span>
20
- <%= password_field_tag :password, "", placeholder: "Password", class: "form-control" %>
21
- </div>
22
- </div>
23
-
24
- <%= hook("auth.login.form") %>
25
-
26
- <% if Trestle.config.auth.remember.enabled %>
27
- <div class="form-group">
28
- <label class="remember-me">
29
- <%= check_box_tag :remember_me %>
30
- <%= t("admin.auth.remember_me", default: "Remember me") %>
31
- </label>
32
- </div>
33
- <% end %>
34
-
35
- <div class="form-group">
36
- <%= submit_tag t("admin.auth.login", default: "Login"), class: "btn btn-primary btn-block" %>
37
- </div>
14
+ <%= render "form", f: f %>
38
15
  <% end %>
data/bin/rails ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails gems
3
+ # installed from the root of your application.
4
+
5
+ ENGINE_ROOT = File.expand_path('..', __dir__)
6
+ ENGINE_PATH = File.expand_path('../lib/trestle/auth/engine', __dir__)
7
+
8
+ # Set up gems listed in the Gemfile.
9
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
10
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
11
+
12
+ require "rails"
13
+ # Pick the frameworks you want:
14
+ require "active_model/railtie"
15
+ require "active_record/railtie"
16
+ require "action_controller/railtie"
17
+ require "action_view/railtie"
18
+ require "sprockets/railtie"
19
+ # require "rails/test_unit/railtie"
20
+ require 'rails/engine/commands'
@@ -6,3 +6,10 @@ en:
6
6
  logout: "Logout"
7
7
  error: "Incorrect login details."
8
8
  remember_me: "Remember me"
9
+
10
+ auth/account:
11
+ titles:
12
+ edit: "My Account"
13
+
14
+ breadcrumbs:
15
+ index: "My Account"
@@ -0,0 +1,15 @@
1
+ es:
2
+ admin:
3
+ auth:
4
+ my_account: "Mi Cuenta"
5
+ login: "Inicio de sesión"
6
+ logout: "Sair"
7
+ error: "Email o contraseña incorrectos."
8
+ remember_me: "Recuérdame"
9
+
10
+ auth/account:
11
+ titles:
12
+ edit: "Mi Cuenta"
13
+
14
+ breadcrumbs:
15
+ index: "Mi Cuenta"
@@ -6,3 +6,10 @@ pl:
6
6
  logout: "Wyloguj się"
7
7
  error: "Nieprawidłowe dane logowania."
8
8
  remember_me: "Zapamiętaj mnie"
9
+
10
+ auth/account:
11
+ titles:
12
+ edit: "Moje konto"
13
+
14
+ breadcrumbs:
15
+ index: "Moje konto"
@@ -6,3 +6,10 @@ pt-BR:
6
6
  logout: "Sair"
7
7
  error: "Email ou Senha incorretos."
8
8
  remember_me: "Lembrar-me"
9
+
10
+ auth/account:
11
+ titles:
12
+ edit: "Minha Conta"
13
+
14
+ breadcrumbs:
15
+ index: "Minha Conta"
File without changes
data/config/routes.rb CHANGED
@@ -1,7 +1,12 @@
1
1
  Trestle::Engine.routes.draw do
2
2
  controller "trestle/auth/sessions" do
3
- get 'login' => :new, as: :login
4
- post 'login' => :create
5
- get 'logout' => :destroy, as: :logout
3
+ if Trestle.config.auth.enable_login
4
+ get 'login' => :new, as: :login
5
+ post 'login' => :create
6
+ end
7
+
8
+ if Trestle.config.auth.enable_logout
9
+ get 'logout' => :destroy, as: :logout
10
+ end
6
11
  end
7
12
  end
@@ -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
+ }