any_login 1.5.2 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/any_login/application.css +3 -0
  3. data/app/controllers/any_login/application_controller.rb +1 -9
  4. data/app/views/any_login/_any_login.html.erb +4 -4
  5. data/app/views/any_login/assets/_css.html.erb +101 -0
  6. data/app/views/any_login/assets/_js.html.erb +25 -0
  7. data/app/views/any_login/svg/_user.html.erb +1 -2
  8. data/config/routes.rb +0 -2
  9. data/lib/any_login/helpers.rb +3 -1
  10. data/lib/any_login/providers/devise.rb +1 -1
  11. data/lib/any_login/version.rb +1 -1
  12. data/test/rails_apps/authlogic/db/development.sqlite3 +0 -0
  13. data/test/rails_apps/authlogic/db/test.sqlite3 +0 -0
  14. data/test/rails_apps/authlogic/db/test.sqlite3-shm +0 -0
  15. data/test/rails_apps/authlogic/db/test.sqlite3-wal +0 -0
  16. data/test/rails_apps/authlogic/log/development.log +438 -0
  17. data/test/rails_apps/authlogic/log/test.log +1144 -0
  18. data/test/rails_apps/authlogic/tmp/development_secret.txt +1 -0
  19. data/test/rails_apps/authlogic/tmp/local_secret.txt +1 -0
  20. data/test/rails_apps/clearance/config/environment.rb +1 -0
  21. data/test/rails_apps/clearance/db/development.sqlite3 +0 -0
  22. data/test/rails_apps/clearance/db/test.sqlite3 +0 -0
  23. data/test/rails_apps/clearance/db/test.sqlite3-shm +0 -0
  24. data/test/rails_apps/clearance/db/test.sqlite3-wal +0 -0
  25. data/test/rails_apps/clearance/log/development.log +388 -0
  26. data/test/rails_apps/clearance/log/test.log +1110 -0
  27. data/test/rails_apps/clearance/tmp/development_secret.txt +1 -0
  28. data/test/rails_apps/clearance/tmp/local_secret.txt +1 -0
  29. data/test/rails_apps/devise/db/development.sqlite3 +0 -0
  30. data/test/rails_apps/devise/db/schema.rb +4 -4
  31. data/test/rails_apps/devise/db/test.sqlite3 +0 -0
  32. data/test/rails_apps/devise/db/test.sqlite3-shm +0 -0
  33. data/test/rails_apps/devise/db/test.sqlite3-wal +0 -0
  34. data/test/rails_apps/devise/log/development.log +1081 -0
  35. data/test/rails_apps/devise/log/test.log +2120 -0
  36. data/test/rails_apps/devise/tmp/development_secret.txt +1 -0
  37. data/test/rails_apps/devise/tmp/local_secret.txt +1 -0
  38. data/test/rails_apps/sorcery/db/development.sqlite3 +0 -0
  39. data/test/rails_apps/sorcery/db/test.sqlite3 +0 -0
  40. data/test/rails_apps/sorcery/db/test.sqlite3-shm +0 -0
  41. data/test/rails_apps/sorcery/db/test.sqlite3-wal +0 -0
  42. data/test/rails_apps/sorcery/log/development.log +247 -0
  43. data/test/rails_apps/sorcery/log/test.log +532 -0
  44. data/test/rails_apps/sorcery/tmp/development_secret.txt +1 -0
  45. data/test/rails_apps/sorcery/tmp/local_secret.txt +1 -0
  46. data/test/test_helper_common.rb +2 -1
  47. metadata +85 -6
  48. data/app/assets/javascripts/any_login/application.js +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5bf2e4379dc3292f4370eccad6f0e9f25ae89d7f871525cfe8dc631b25ec38e
4
- data.tar.gz: 8272a7055d6aca546c6f78375c026520691900b8f35c854724488cd767cf73dc
3
+ metadata.gz: bfc947837944c5fd9470108cd402ac191433e9b79d1f49820ff9f7709e5c6d0a
4
+ data.tar.gz: 13dceae2e364d6a13a694855b1d2539216b1e4c5d7fb93d550a7df8a17ff2ba7
5
5
  SHA512:
6
- metadata.gz: c44e654790b0df3ed3c8280e6f3bad9ea29513068a2f0fa7529a127884342dae5b707916bdee2b0d9b5a6e1f1c04b666c31419293c634f9532f7d262290279d0
7
- data.tar.gz: 9b38b9cf3010608a432c818c8ae52b2f4ef4d12129ece50daf61cd8e048b6b2b8696fad525156ab99d962f8647260ea53e6a9222d04b5180510bf41e3d6ac200
6
+ metadata.gz: beca6cddab932f7c230a1d5ec979789d72ec54f1b7cea40bfdc56949680641534a0d2c8fe29b8664fa5073abf2324cc9f89d3eb76e6e7d56eef5a248fa96d557
7
+ data.tar.gz: 9ab1c3b8fb682bc8037e1caa9e741a1d4933676dcc76f3f68746d80a9c1472fca7fd67a73de3734ce7530f6079887c4c90b18265913806c64a81b7c93d1e0141
@@ -12,6 +12,9 @@
12
12
  margin: 0;
13
13
  height: auto;
14
14
  padding: 4px 6px;
15
+ display: flex;
16
+ align-items: center;
17
+ gap: 6px;
15
18
  }
16
19
 
17
20
  #any_login #any_login_box {
@@ -1,6 +1,6 @@
1
1
  module AnyLogin
2
2
  class ApplicationController < ActionController::Base
3
- protect_from_forgery except: :js
3
+ protect_from_forgery
4
4
  before_action :try_not_to_leak_any_login_is_installed
5
5
 
6
6
  include AnyLogin.provider.constantize::Controller
@@ -19,14 +19,6 @@ module AnyLogin
19
19
  AnyLogin.provider.constantize::Controller.instance_method(:any_login_sign_in).bind(self).call
20
20
  end
21
21
 
22
- def css
23
- send_file AnyLogin::Engine.root.join('app', 'assets', 'stylesheets', 'any_login', 'application.css'), content_type: 'text/css'
24
- end
25
-
26
- def js
27
- send_file AnyLogin::Engine.root.join('app', 'assets', 'javascripts', 'any_login', 'application.js'), content_type: 'text/javascript'
28
- end
29
-
30
22
  private
31
23
 
32
24
  def try_not_to_leak_any_login_is_installed
@@ -1,10 +1,10 @@
1
- <script src="<%= any_login.js_path %>"></script>
2
- <link rel="stylesheet" href="<%= any_login.css_path %>">
1
+ <%= render 'any_login/assets/js' %>
2
+ <%= render 'any_login/assets/css' %>
3
3
 
4
4
  <div id='any_login' class='<%= any_login_klasses %>'>
5
- <%= form_tag any_login.sign_in_path, :method => :post, :id => 'any_login_form' do %>
5
+ <%= form_tag any_login.sign_in_path, method: :post, id: 'any_login_form' do %>
6
6
  <label for="any_login_form_toggle" id="any_login_form_toggle_label">
7
- <%= render 'any_login/svg/user', :title => AnyLogin.klass %>
7
+ <%= render 'any_login/svg/user', title: AnyLogin.klass %>
8
8
  </label>
9
9
  <input type="checkbox" id="any_login_form_toggle" <%= AnyLogin.auto_show ? "checked" : "" %>>
10
10
  <span id='any_login_box'>
@@ -0,0 +1,101 @@
1
+ <style>
2
+ #any_login {
3
+ position: fixed;
4
+ opacity: 0.5;
5
+ background: #5c4383;
6
+ color: white;
7
+ font-size: 16px;
8
+ line-height: 20px;
9
+ z-index: 10000;
10
+ }
11
+
12
+ #any_login form {
13
+ margin: 0;
14
+ height: auto;
15
+ padding: 4px 6px;
16
+ display: flex;
17
+ align-items: center;
18
+ gap: 6px;
19
+ }
20
+
21
+ #any_login #any_login_box {
22
+ display: none;
23
+ vertical-align: middle;
24
+ }
25
+
26
+ #any_login_form_toggle {
27
+ display: none;
28
+ }
29
+
30
+ #any_login_form_toggle[type=checkbox]:checked ~ #any_login_box {
31
+ display: inline;
32
+ }
33
+
34
+ #any_login input,
35
+ #any_login select {
36
+ color: black;
37
+ padding: 0;
38
+ margin: 0;
39
+ height: auto;
40
+ float: none;
41
+ text-decoration: none;
42
+ position: unset;
43
+ left: auto;
44
+ top: auto;
45
+ font-size: auto;
46
+ line-height: auto;
47
+ }
48
+
49
+ #any_login.any_login_top_left {
50
+ top: 0;
51
+ left: 0;
52
+ }
53
+
54
+ #any_login.any_login_top_right {
55
+ top: 0;
56
+ right: 0;
57
+ }
58
+
59
+ #any_login.any_login_bottom_left {
60
+ bottom: 0;
61
+ left: 0;
62
+ }
63
+
64
+ #any_login.any_login_bottom_right {
65
+ bottom: 0;
66
+ right: 0;
67
+ }
68
+
69
+ #any_login svg {
70
+ cursor: pointer;
71
+ vertical-align: middle;
72
+ fill: #fff;
73
+ }
74
+
75
+ #any_login:hover {
76
+ opacity: 1;
77
+ }
78
+
79
+ #any_login .any_login_user_information {
80
+ padding-left: 10px;
81
+ color: yellow;
82
+ }
83
+
84
+ #any_login #any_login_id_input {
85
+ width: 30px;
86
+ }
87
+
88
+ #any_login span#current_user_information {
89
+ display: inline;
90
+ }
91
+
92
+ #any_login span#current_user_information span {
93
+ display: inline;
94
+ }
95
+
96
+ #any_login span#anylogin_back_to_user {
97
+ padding-left: 15px;
98
+ color: cyan;
99
+ display: inline;
100
+ }
101
+ </style>
@@ -0,0 +1,25 @@
1
+ <script>
2
+ function submitOnChange() {
3
+ document.getElementById('any_login_form').submit();
4
+ }
5
+
6
+ function elementExists(element) {
7
+ return typeof (element) != 'undefined' && element != null;
8
+ }
9
+
10
+ function addChangeListenerTo(elementId) {
11
+ let element = document.getElementById(elementId);
12
+ if (elementExists(element)) {
13
+ element.addEventListener("change", submitOnChange);
14
+ }
15
+ }
16
+
17
+ function setupAnyLoginHandlers() {
18
+ addChangeListenerTo("back_to_previous_id");
19
+ addChangeListenerTo("selected_id");
20
+ }
21
+
22
+ ['DOMContentLoaded', 'turbolinks:load', 'turbo:load'].forEach(function(e) {
23
+ window.addEventListener(e, setupAnyLoginHandlers);
24
+ });
25
+ </script>
@@ -1,6 +1,5 @@
1
1
  <?xml version="1.0" ?>
2
- <svg style="enable-background:new 0 0 24 24;" version="1.1" viewBox="0 0 24 24" height="16" width="16" role="img"
3
- xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
+ <svg version="1.1" viewBox="0 0 24 24" height="16" width="16" role="img" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
4
3
  <title><%= title %></title>
5
4
  <g id="info" />
6
5
  <g id="icons">
data/config/routes.rb CHANGED
@@ -1,6 +1,4 @@
1
1
  AnyLogin::Engine.routes.draw do
2
- get '/any_login/js' => 'application#js', as: :js
3
- get '/any_login/css' => 'application#css', as: :css
4
2
  post '/any_login/sign_in' => 'application#any_login', as: :sign_in
5
3
  end
6
4
 
@@ -9,7 +9,9 @@ module AnyLogin
9
9
  if AnyLogin.enabled
10
10
 
11
11
  def any_login_id_input
12
- text_field_tag :id, '', :placeholder => 'ID', :id => 'any_login_id_input', :required => true
12
+ def any_login_id_input
13
+ text_field_tag :id, '', placeholder: 'ID', id: 'any_login_id_input', required: true
14
+ end
13
15
  end
14
16
 
15
17
  def any_login_submit
@@ -6,7 +6,7 @@ module AnyLogin
6
6
 
7
7
  DEFAULT_SIGN_IN = proc do |loginable|
8
8
  reset_session
9
- sign_in Controller.mapping_key, loginable
9
+ sign_in loginable, scope: Controller.mapping_key
10
10
  end
11
11
 
12
12
  def self.any_login_current_user_method
@@ -1,3 +1,3 @@
1
1
  module AnyLogin
2
- VERSION = '1.5.2'
2
+ VERSION = '1.6.0'
3
3
  end
File without changes