phcdevworks_accounts_auth0 0.1.0

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 (32) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +1 -0
  4. data/Rakefile +8 -0
  5. data/app/assets/config/phcdevworks_accounts_auth0_manifest.js +2 -0
  6. data/app/controllers/concerns/secured.rb +13 -0
  7. data/app/controllers/phcdevworks_accounts_auth0/application_controller.rb +15 -0
  8. data/app/controllers/phcdevworks_accounts_auth0/auth/handler_controller.rb +30 -0
  9. data/app/controllers/phcdevworks_accounts_auth0/user/pages_controller.rb +4 -0
  10. data/app/helpers/phcdevworks_accounts_auth0/application_helper.rb +9 -0
  11. data/app/helpers/phcdevworks_accounts_auth0/user/pages_helper.rb +4 -0
  12. data/app/jobs/phcdevworks_accounts_auth0/application_job.rb +4 -0
  13. data/app/mailers/phcdevworks_accounts_auth0/application_mailer.rb +6 -0
  14. data/app/models/phcdevworks_accounts_auth0/application_record.rb +5 -0
  15. data/app/views/layouts/phcdevworks_accounts_auth0/application.html.erb +73 -0
  16. data/app/views/layouts/phcdevworks_accounts_auth0/components/backend/footer/_footer.html.erb +17 -0
  17. data/app/views/layouts/phcdevworks_accounts_auth0/components/backend/navigation/_top_menu.html.erb +39 -0
  18. data/app/views/layouts/phcdevworks_accounts_auth0/components/backend/sidebars/_side_menu.html.erb +921 -0
  19. data/app/views/phcdevworks_accounts_auth0/admin/pages/components/_profile_header.html.erb +27 -0
  20. data/app/views/phcdevworks_accounts_auth0/admin/pages/dashboard.html.erb +0 -0
  21. data/app/views/phcdevworks_accounts_auth0/admin/pages/user_profile.html.erb +22 -0
  22. data/app/views/phcdevworks_accounts_auth0/admin/pages/users_list.html.erb +64 -0
  23. data/app/views/phcdevworks_accounts_auth0/auth/handler/failure.html.erb +0 -0
  24. data/app/views/phcdevworks_accounts_auth0/user/pages/dashboard.html.erb +0 -0
  25. data/app/views/phcdevworks_accounts_auth0/user/pages/profile.html.erb +0 -0
  26. data/config/initializers/auth0.rb +14 -0
  27. data/config/routes.rb +12 -0
  28. data/lib/phcdevworks_accounts_auth0/engine.rb +45 -0
  29. data/lib/phcdevworks_accounts_auth0/version.rb +3 -0
  30. data/lib/phcdevworks_accounts_auth0.rb +6 -0
  31. data/lib/tasks/phcdevworks_accounts_auth0_tasks.rake +4 -0
  32. metadata +388 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5616cea1463669786c01af9840a7da1e6f425e3021c18347fd4cc0a3a3871ccc
4
+ data.tar.gz: 9011492e6be557c30ecba34a62c12f2f7caf27386cf452dc46fdaa6367e80ce5
5
+ SHA512:
6
+ metadata.gz: 25b61e7f8ffebb7dc61f4e6fc3ef29a8fba29d0f340f409ae00baabfc95f7d70c7f6e347ab8913112bdbff58d82772dc77e46e5fe542cb31511299a2876b50a2
7
+ data.tar.gz: b49d4bb43d32597816fb3b30c309bc5bf93f9a245bae2b489cbc977f68db0d4d6afd6f9c2ebb0d926cc8f9a082f1397fad59267d014e49b6321c57661f86bef6
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2022 Brad Potts
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1 @@
1
+ # phcdevworks_accounts_auth0
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/setup"
2
+
3
+ APP_RAKEFILE = File.expand_path("spec/test_app/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
5
+
6
+ load "rails/tasks/statistics.rake"
7
+
8
+ require "bundler/gem_tasks"
@@ -0,0 +1,2 @@
1
+ //= link coloradmin/default/phcthemes_admin_panel_pack_coloradmin.css
2
+ //= link coloradmin/phcthemes_admin_panel_pack_coloradmin.js
@@ -0,0 +1,13 @@
1
+ module Secured
2
+
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ before_action :logged_in_using_omniauth?
7
+ end
8
+
9
+ def logged_in_using_omniauth?
10
+ redirect_to '/' unless session[:userinfo].present?
11
+ end
12
+
13
+ end
@@ -0,0 +1,15 @@
1
+ module PhcdevworksAccountsAuth0
2
+ class ApplicationController < ActionController::Base
3
+
4
+ # Security Filters
5
+ protect_from_forgery with: :exception
6
+
7
+ # Load Requried Helper Files
8
+ helper PhcdevworksActiveMenus::Engine.helpers
9
+ helper PhcdevworksNotifications::Engine.helpers
10
+ helper PhcdevworksTitleseo::Engine.helpers
11
+
12
+ private
13
+
14
+ end
15
+ end
@@ -0,0 +1,30 @@
1
+ module PhcdevworksAccountsAuth0
2
+ class Auth::HandlerController < ApplicationController
3
+
4
+ def callback
5
+ auth_info = request.env['omniauth.auth']
6
+ session[:userinfo] = auth_info['extra']['raw_info']
7
+ redirect_to '/user/dashboard'
8
+ end
9
+
10
+ def failure
11
+ # Failed Authentication
12
+ @error_msg = request.params['message']
13
+ end
14
+
15
+ def logout
16
+ # Logout
17
+ reset_session
18
+ redirect_to logout_url
19
+ end
20
+
21
+ def logout_url
22
+ request_params = {
23
+ returnTo: root_url,
24
+ client_id: AUTH0_CONFIG['auth0_client_id']
25
+ }
26
+ URI::HTTPS.build(host: AUTH0_CONFIG['auth0_domain'], path: '/v2/logout', query: request_params.to_query).to_s
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,4 @@
1
+ module PhcdevworksAccountsAuth0
2
+ class User::PagesController < ApplicationController
3
+ end
4
+ end
@@ -0,0 +1,9 @@
1
+ module PhcdevworksAccountsAuth0
2
+ module ApplicationHelper
3
+
4
+ def current_user
5
+ @current_user = session['userinfo']
6
+ end
7
+
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ module PhcdevworksAccountsAuth0
2
+ module User::PagesHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module PhcdevworksAccountsAuth0
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module PhcdevworksAccountsAuth0
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: "from@example.com"
4
+ layout "mailer"
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module PhcdevworksAccountsAuth0
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,73 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+
5
+ <!-- SEO System -->
6
+ <% phc_seo_title "PHCDevworks Accounts" %>
7
+ <% phc_seo_description "Ruby on Rails 7 Authentication and User Management Engine." %>
8
+ <!-- SEO System -->
9
+
10
+ <!-- SEO and Site Description -->
11
+ <meta charset="utf-8">
12
+ <title><%= yield(:phc_seo_title) %></title>
13
+ <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />
14
+ <meta name="description" content="<%= yield(:phc_seo_description) %>">
15
+ <!-- SEO and Site Description -->
16
+
17
+ <!-- Rails Security Tags -->
18
+ <%= csrf_meta_tags %>
19
+ <%= csp_meta_tag %>
20
+ <!-- Rails Security Tags -->
21
+
22
+ <!-- CSS Styles -->
23
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
24
+ <%= stylesheet_link_tag "coloradmin/default/phcthemes_admin_panel_pack_coloradmin", media: "all" %>
25
+ <!-- CSS Styles -->
26
+
27
+ </head>
28
+ <body>
29
+
30
+ <!-- -PHCDEV- Page Container -->
31
+ <div id="app" class="app app-header-fixed app-sidebar-fixed app-with-wide-sidebar">
32
+
33
+ <!-- -PHCDEV- Page Container - Header -->
34
+ <div id="header" class="app-header">
35
+ <%= render "layouts/phcdevworks_accounts_auth0/components/backend/navigation/top_menu" %>
36
+ </div>
37
+ <!-- -PHCDEV- Page Container - Header -->
38
+
39
+ <!-- -PHCDEV- Page Container - Sidebar -->
40
+ <div id="sidebar" class="app-sidebar" data-disable-slide-animation="true">
41
+ <%= render "layouts/phcdevworks_accounts_auth0/components/backend/sidebars/side_menu" %>
42
+ </div>
43
+ <div class="app-sidebar-bg"></div>
44
+ <div class="app-sidebar-mobile-backdrop"><a href="#" data-dismiss="app-sidebar-mobile" class="stretched-link"></a></div>
45
+ <!-- -PHCDEV- Page Container - Sidebar -->
46
+
47
+ <!-- -PHCDEV- Page Container - Content -->
48
+ <div id="app" class="app app-content-full-height">
49
+ <div id="content" class="app-content d-flex flex-column p-0">
50
+ <!-- -PHCDEV- Page Container - Main -->
51
+ <div class="app-content-padding flex-grow-1 overflow-hidden" data-scrollbar="true" data-height="100%">
52
+ <%= render "phcdevworks_notifications/bootstrap/notifications" %>
53
+ <%= yield %>
54
+ </div>
55
+ <!-- -PHCDEV- Page Container - Main -->
56
+ <!-- -PHCDEV- Page Container - Footer -->
57
+ <div id="footer" class="app-footer m-0">
58
+ <%= render "layouts/phcdevworks_accounts_auth0/components/backend/footer/footer" %>
59
+ </div>
60
+ <!-- -PHCDEV- Page Container - Footer -->
61
+ </div>
62
+ </div>
63
+ <!-- -PHCDEV- Page Container - Content -->
64
+
65
+ </div>
66
+ <!-- -PHCDEV- Page Container -->
67
+
68
+ <!-- JavaScript -->
69
+ <%= javascript_include_tag "coloradmin/phcthemes_admin_panel_pack_coloradmin" %>
70
+ <!-- JavaScript -->
71
+
72
+ </body>
73
+ </html>
@@ -0,0 +1,17 @@
1
+ <!-- -PHCDEV- Page Container - Footer - Left -->
2
+ <span>
3
+ <!-- -PHCDEV- Page Container - Footer - Left - Copyright -->
4
+ <i class="fab fa-osi font-weight-bolder"></i> 2012-<%= Time.now.year %> -
5
+ <span class="phc_dev_strong_plugin">PHC</span><span class="phc_dev_light_plugin">Devworks</span> Accounts (Auth0) - Engine v<%= Gem.loaded_specs["phcdevworks_accounts_auth0"].version.to_s %>
6
+ <!-- -PHCDEV- Page Container - Footer - Left - Copyright -->
7
+ </span>
8
+ <!-- -PHCDEV- Page Container - Footer - Left -->
9
+
10
+ <!-- -PHCDEV- Page Container - Footer - Right -->
11
+ <span class="float-right">
12
+ <!-- -PHCDEV- Page Container - Footer - Right - Developed -->
13
+ Developed with <i class="fas fa-heart hanna_hearts"></i> by
14
+ <a class="phcnet_copyright text-dark" href="https://phcdevworks.com/"><u><span class="phc_dev_strong_plugin">PHC</span><span class="phc_dev_light_plugin">Devworks</span></u></a>
15
+ <!-- -PHCDEV- Page Container - Footer - Right - Developed -->
16
+ </span>
17
+ <!-- -PHCDEV- Page Container - Footer - Right -->
@@ -0,0 +1,39 @@
1
+ <!-- -PHCDEV- Topbar - Navigation Header -->
2
+ <div class="navbar-header">
3
+
4
+ <button type="button" class="navbar-mobile-toggler" data-toggle="app-sidebar-mobile">
5
+ <span class="icon-bar"></span>
6
+ <span class="icon-bar"></span>
7
+ <span class="icon-bar"></span>
8
+ </button>
9
+
10
+ <%= link_to phcdevworks_accounts_auth0.user_profile_path, class: "navbar-brand" do %>
11
+ <span class="phc_dev_strong_plugin_logo">PHC</span><span class="phc_dev_light_plugin_logo">Devworks</span>
12
+ <% end %>
13
+
14
+ </div>
15
+ <!-- -PHCDEV- Topbar - Navigation Header -->
16
+
17
+ <!-- -PHCDEV- Topbar - Navigation Main -->
18
+ <% if current_user %>
19
+ <div class="navbar-nav">
20
+ <div class="navbar-item navbar-user dropdown">
21
+ <a href="#" class="navbar-link dropdown-toggle d-flex align-items-center" data-bs-toggle="dropdown">
22
+ <%= image_tag current_user.gravatar_url %>
23
+ <span>
24
+ <span class="d-none d-md-inline"><%= current_user.firstname + " " + current_user.lastname %></span>
25
+ <b class="caret"></b>
26
+ </span>
27
+ </a>
28
+ <div class="dropdown-menu dropdown-menu-end me-1">
29
+ <%= link_to phcdevworks_accounts_auth0.user_profile_path, class: "dropdown-item" do %>
30
+ <i class="fad fa-cogs"></i> Account Settings
31
+ <% end %>
32
+ <%= link_to phcdevworks_accounts_auth0.auth_logout_path, class: "dropdown-item" do %>
33
+ <i class="fad fa-sign-out-alt"></i> Logout
34
+ <% end %>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ <% end %>
39
+ <!-- -PHCDEV- Topbar - Navigation Main -->