phcdevworks_accounts_auth0 0.3.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/phcdevworks_accounts_auth0/user/pages_controller.rb +10 -0
- data/app/helpers/phcdevworks_accounts_auth0/application_helper.rb +20 -0
- data/app/views/layouts/phcdevworks_accounts_auth0/components/backend/navigation/_top_menu.html.erb +2 -2
- data/app/views/layouts/phcdevworks_accounts_auth0/components/backend/sidebars/_side_menu.html.erb +22 -5
- data/app/views/phcdevworks_accounts_auth0/user/pages/profile.html.erb +4 -0
- data/config/routes.rb +4 -4
- data/lib/phcdevworks_accounts_auth0/version.rb +1 -1
- metadata +1 -2
- data/app/helpers/phcdevworks_accounts_auth0/user/pages_helper.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 330728b841f8d36c168b82959b07ab61496f18b58fe84ffcc745ae37207685ea
|
4
|
+
data.tar.gz: 33fa99a27bd820a4e35010da44bfc1c1d6cfbcd40660c50108d057528846bd63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 297ef0b8006bbc3ca2489b8552f08ef5505971b8ee179bbcc03f46d7c5c9ef82431e0fc26e742b009d1f8fef1dc2a21bf26fc46ed5deff4d09df053a1ddf69ab
|
7
|
+
data.tar.gz: b10458d97f1c5d7840ce8a25db98b05dc580b51637d360593f330c39d2d57370a145938e7673869cecff6aff427cee14689e12cf463a3580a7ba7b66ad3f24fc
|
@@ -1,6 +1,26 @@
|
|
1
1
|
module PhcdevworksAccountsAuth0
|
2
2
|
module ApplicationHelper
|
3
3
|
|
4
|
+
def user_signed_in?
|
5
|
+
session['userinfo'].present?
|
6
|
+
end
|
7
|
+
|
8
|
+
def authenticate_user!
|
9
|
+
if user_signed_in?
|
10
|
+
@current_user = session['userinfo']
|
11
|
+
else
|
12
|
+
redirect_to root_path
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def current_user
|
17
|
+
@current_user
|
18
|
+
end
|
19
|
+
|
20
|
+
def reset_session
|
21
|
+
session['userinfo'] = nil if session['userinfo'].present?
|
22
|
+
end
|
23
|
+
|
4
24
|
def current_user
|
5
25
|
@current_user = session['userinfo']
|
6
26
|
end
|
data/app/views/layouts/phcdevworks_accounts_auth0/components/backend/navigation/_top_menu.html.erb
CHANGED
@@ -19,9 +19,9 @@
|
|
19
19
|
<div class="navbar-nav">
|
20
20
|
<div class="navbar-item navbar-user dropdown">
|
21
21
|
<a href="#" class="navbar-link dropdown-toggle d-flex align-items-center" data-bs-toggle="dropdown">
|
22
|
-
<%= image_tag current_user
|
22
|
+
<%= image_tag current_user['picture'] %>
|
23
23
|
<span>
|
24
|
-
<span class="d-none d-md-inline"><%= current_user
|
24
|
+
<span class="d-none d-md-inline"><%= current_user['name'] %></span>
|
25
25
|
<b class="caret"></b>
|
26
26
|
</span>
|
27
27
|
</a>
|
data/app/views/layouts/phcdevworks_accounts_auth0/components/backend/sidebars/_side_menu.html.erb
CHANGED
@@ -8,16 +8,33 @@
|
|
8
8
|
<a href="javascript:;" class="menu-profile-link" data-toggle="app-sidebar-profile" data-target="#appSidebarProfileMenu">
|
9
9
|
<div class="menu-profile-cover with-shadow"></div>
|
10
10
|
<div class="menu-profile-image">
|
11
|
-
|
11
|
+
<% if defined?phcdevworks_accounts_devise %>
|
12
|
+
<%= image_tag current_user.gravatar_url %>
|
13
|
+
<% end %>
|
14
|
+
<% if defined?phcdevworks_accounts_auth0 %>
|
15
|
+
<%= image_tag current_user['picture'] %>
|
16
|
+
<% end %>
|
12
17
|
</div>
|
13
18
|
<div class="menu-profile-info">
|
14
19
|
<div class="d-flex align-items-center">
|
15
20
|
<div class="flex-grow-1">
|
16
|
-
|
21
|
+
<% if defined?phcdevworks_accounts_devise %>
|
22
|
+
<%= current_user.firstname + " " + current_user.lastname %>
|
23
|
+
<% end %>
|
24
|
+
<% if defined?phcdevworks_accounts_auth0 %>
|
25
|
+
<%= current_user['name'] %>
|
26
|
+
<% end %>
|
17
27
|
</div>
|
18
28
|
<div class="menu-caret ms-auto"></div>
|
19
29
|
</div>
|
20
|
-
<small
|
30
|
+
<small>
|
31
|
+
<% if defined?phcdevworks_accounts_devise %>
|
32
|
+
<%= current_user.username %>
|
33
|
+
<% end %>
|
34
|
+
<% if defined?phcdevworks_accounts_auth0 %>
|
35
|
+
<%= current_user['nickname'] %>
|
36
|
+
<% end %>
|
37
|
+
</small>
|
21
38
|
</div>
|
22
39
|
</a>
|
23
40
|
<% end %>
|
@@ -833,7 +850,7 @@
|
|
833
850
|
|
834
851
|
<!-- -PHCDEV- Page Container - Sidebar - Navigation - PHCDevworks Accounts -->
|
835
852
|
|
836
|
-
<% if defined?phcdevworks_accounts_stripe and current_user.admin? %>
|
853
|
+
<% if defined?phcdevworks_accounts_stripe and defined?phcdevworks_accounts_devise and current_user.admin? %>
|
837
854
|
<div class="menu-header">Subscription Administration</div>
|
838
855
|
<div class="menu-item has-sub">
|
839
856
|
<a href="javascript:;" class="menu-link">
|
@@ -889,7 +906,7 @@
|
|
889
906
|
</div>
|
890
907
|
</div>
|
891
908
|
<% end %>
|
892
|
-
<% if current_user and current_user.admin? %>
|
909
|
+
<% if defined?phcdevworks_accounts_devise and current_user and current_user.admin? %>
|
893
910
|
<div class="menu-header">Login Administration</div>
|
894
911
|
<div class="menu-item has-sub">
|
895
912
|
<a href="javascript:;" class="menu-link">
|
data/config/routes.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
PhcdevworksAccountsAuth0::Engine.routes.draw do
|
2
2
|
|
3
3
|
# User Dashboard
|
4
|
-
|
5
|
-
|
4
|
+
get "dashboard" => 'user/pages#dashboard'
|
5
|
+
get "profile" => 'user/pages#profile'
|
6
6
|
|
7
7
|
# Auth Routes
|
8
|
-
get "/auth/
|
9
|
-
get "/auth/
|
8
|
+
get "/auth/", as: "authentication"
|
9
|
+
get "/auth/callback" => "auth/handler#callback"
|
10
10
|
get "/auth/failure" => "auth/handler#failure"
|
11
11
|
get "/auth/logout" => "auth/handler#logout"
|
12
12
|
get "/auth/redirect" => "auth/handler#redirect"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phcdevworks_accounts_auth0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PHCDevworks
|
@@ -337,7 +337,6 @@ files:
|
|
337
337
|
- app/controllers/phcdevworks_accounts_auth0/auth/handler_controller.rb
|
338
338
|
- app/controllers/phcdevworks_accounts_auth0/user/pages_controller.rb
|
339
339
|
- app/helpers/phcdevworks_accounts_auth0/application_helper.rb
|
340
|
-
- app/helpers/phcdevworks_accounts_auth0/user/pages_helper.rb
|
341
340
|
- app/jobs/phcdevworks_accounts_auth0/application_job.rb
|
342
341
|
- app/mailers/phcdevworks_accounts_auth0/application_mailer.rb
|
343
342
|
- app/models/phcdevworks_accounts_auth0/application_record.rb
|