taskinator_ui 0.1.0 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97f775b342af29cff581b4367d7ddd723a9efac20a7af5ddbbbb465d47b5a99f
4
- data.tar.gz: ce586f511c32214c706964b941ad3d0e3d14bb2fd90ab4c164610d90b71c0e00
3
+ metadata.gz: 7bbff9fb448c633632f969f7f4eda1b0133e9ad82011860f5fcb275a57a75813
4
+ data.tar.gz: 7faa5609c48e334fe56517caeae1cb4507cc047d026f0843057a2e33f28866e9
5
5
  SHA512:
6
- metadata.gz: 4dc61c2f71155ced014d843addd3eba0c6037778f6d1bc61f16156fa0aa052982c771f9774ffb968735744c9e6052049b2497cf42318537bdfc8c2eb474a2bf2
7
- data.tar.gz: a858248ed643e25f74e53e4bda2a34833512c3b79cc9b17e1ad5420d35f46c40f326b3304fe95af2ae4c463412d36f4d76180ebf4b965a4ce3b7981a559b9e6d
6
+ metadata.gz: 4113967deba386a838dbb3c66b7358d9d0e10b2bb5a7cb22888b89b970344db3ab6d3782c3983df53bb9ce1c6d9279195ee490ce24bf8ab9593eabe83db9dd1c
7
+ data.tar.gz: 95ab956ef3088d79ed31a79cdb3fd0e4a578efca066cadef72bc03e7422c80840e0ceddd051ced9092c6b609de04c7d39f6bb77114127171086b8b0ffae56a39
data/README.md CHANGED
@@ -26,6 +26,22 @@ mount TaskinatorUi::Engine, at: '/taskinator'
26
26
 
27
27
  Run `rails server` and navigate to `http://localhost:3000/taskinator/`
28
28
 
29
+ ## HTTP Basic Auth
30
+
31
+ To add basic auth add the line into initializer:
32
+
33
+ ```ruby
34
+ # config/initializers/taskinator.rb
35
+
36
+ TaskinatorUi.http_basic_auth = ->(user, password) { user == 'username' && password == 'password' }
37
+ ```
38
+
39
+ You can use your database if needed:
40
+
41
+ ```ruby
42
+ TaskinatorUi.http_basic_auth = ->(email, password) { User.admin.find_by(email: email)&.authenticate(password) }
43
+ ```
44
+
29
45
  ## Known issues
30
46
 
31
47
  If you use Rails in API only mode it can happen that you have `Rack::MethodOverride` middleware disabled.
@@ -1,4 +1,11 @@
1
1
  module TaskinatorUi
2
2
  class ApplicationController < ActionController::Base
3
+ before_action :authenticate, if: -> { TaskinatorUi.http_basic_auth }
4
+
5
+ protected
6
+
7
+ def authenticate
8
+ authenticate_or_request_with_http_basic(nil, nil, &TaskinatorUi.http_basic_auth)
9
+ end
3
10
  end
4
11
  end
@@ -1,3 +1,3 @@
1
1
  module TaskinatorUi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/taskinator_ui.rb CHANGED
@@ -2,5 +2,5 @@ require "taskinator_ui/version"
2
2
  require "taskinator_ui/engine"
3
3
 
4
4
  module TaskinatorUi
5
- # Your code goes here...
5
+ cattr_accessor :http_basic_auth
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taskinator_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdan Guban
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-24 00:00:00.000000000 Z
11
+ date: 2023-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -49,7 +49,7 @@ files:
49
49
  - README.md
50
50
  - Rakefile
51
51
  - app/assets/config/taskinator_ui_manifest.js
52
- - app/assets/stylesheets/taskinator_ui/application.scss
52
+ - app/assets/stylesheets/taskinator_ui/application.css
53
53
  - app/controllers/taskinator_ui/application_controller.rb
54
54
  - app/controllers/taskinator_ui/processes_controller.rb
55
55
  - app/decorators/taskinator_ui/process_decorator.rb
@@ -1 +0,0 @@
1
- @import "bootstrap";