j1-template 2021.0.1 → 2021.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/data/quicklinks.html +2 -2
- data/assets/themes/j1/adapter/js/j1.js +28 -7
- data/assets/themes/j1/modules/iframeResizer/LICENSE +21 -21
- data/assets/themes/j1/modules/lightbox/LICENSE +22 -22
- data/assets/themes/j1/modules/twemoji/js/LICENSE +21 -21
- data/assets/themes/j1/modules/twemoji/js/picker/LICENSE +21 -21
- data/exe/j1 +2 -0
- data/lib/j1/commands/generate.rb +47 -47
- data/lib/j1/patches/rubygems/eventmachine-1.2.7-x64-mingw32/lib/2.6/fastfilereaderext.so +0 -0
- data/lib/j1/patches/rubygems/eventmachine-1.2.7-x64-mingw32/lib/2.6/rubyeventmachine.so +0 -0
- data/lib/j1/utils/exec.rb +1 -1
- data/lib/j1/version.rb +1 -1
- data/lib/j1_app/j1_auth_manager/commands.rb +1 -1
- data/lib/patches/rubygems/eventmachine-1.2.7-x64-mingw32/lib/2.6/fastfilereaderext.so +0 -0
- data/lib/patches/rubygems/eventmachine-1.2.7-x64-mingw32/lib/2.6/rubyeventmachine.so +0 -0
- data/lib/starter_web/Gemfile +18 -8
- data/lib/starter_web/_config.yml +2 -2
- data/lib/starter_web/_data/modules/defaults/authentication.yml +44 -42
- data/lib/starter_web/_data/modules/themer.yml +0 -95
- data/lib/starter_web/_data/resources.yml +2 -2
- data/lib/starter_web/_includes/attributes.asciidoc +1 -1
- data/lib/starter_web/_includes/documents/licenses/mit.asciidoc +19 -19
- data/lib/starter_web/_includes/tables/jekyll_variables.asciidoc +45 -45
- data/lib/starter_web/_includes/tables/template_variables.asciidoc +46 -46
- data/lib/starter_web/assets/images/modules/icons/d1/scalable/d1.svg +1 -1
- data/lib/starter_web/assets/images/pages/j1_webhooks/uml/auth_mgmr_signin_request_flow.uxf +632 -632
- data/lib/starter_web/assets/images/pages/j1_webhooks/uml/webhook_flow.uxf +648 -648
- data/lib/starter_web/collections/posts/public/featured/_posts/2019-06-01-about-cookies.adoc +198 -198
- data/lib/starter_web/collections/posts/public/featured/_posts/_includes/documents/readme +1 -0
- data/lib/starter_web/collections/posts/public/featured/_posts/_includes/documents/unsplash-badge.asciidoc +31 -31
- data/lib/starter_web/collections/posts/public/series/_posts/_includes/documents/100-docker-using-shared-folders.asciidoc +430 -430
- data/lib/starter_web/collections/posts/public/series/_posts/_includes/tables/debug_variables.asciidoc +47 -48
- data/lib/starter_web/config.ru +23 -24
- data/lib/starter_web/dot.nojekyll +19 -19
- data/lib/starter_web/package.json +46 -40
- data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/_includes/documents/300_first_awesome_web.asciidoc +11 -12
- data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/_includes/tables/debug_variables.asciidoc +47 -48
- data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/_includes/tables/readme +1 -0
- data/lib/starter_web/pages/public/learn/roundtrip/600_lunr.adoc +236 -236
- data/lib/starter_web/pages/public/learn/roundtrip/_includes/documents/410_bottom_info.asciidoc +14 -14
- data/lib/starter_web/pages/public/learn/roundtrip/_includes/documents/410_bottom_left_warning.asciidoc +11 -11
- data/lib/starter_web/pages/public/learn/roundtrip/_includes/documents/410_bottom_right_danger.asciidoc +11 -11
- data/lib/starter_web/pages/public/learn/roundtrip/_includes/documents/410_central_success.asciidoc +11 -11
- data/lib/starter_web/pages/public/learn/roundtrip/_includes/documents/410_full_height_left_info.asciidoc +11 -11
- data/lib/starter_web/pages/public/learn/roundtrip/_includes/documents/410_full_height_right_success.asciidoc +11 -11
- data/lib/starter_web/pages/public/learn/roundtrip/_includes/documents/410_top_info.asciidoc +11 -11
- data/lib/starter_web/pages/public/learn/roundtrip/_includes/documents/410_top_left_info.asciidoc +11 -11
- data/lib/starter_web/pages/public/learn/roundtrip/_includes/documents/410_top_right_success.asciidoc +11 -11
- data/lib/starter_web/pages/public/legal/en/eu/cookie.policy.asciidoc +50 -55
- data/lib/starter_web/pages/public/previewer/_includes/documents/licenses/mit.asciidoc +19 -19
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +31 -31
- data/lib/j1_app/j1_auth_manager/views/auth_manager_ui.erb.kapott +0 -234
- data/lib/j1_app/j1_auth_manager/views/auth_manager_ui.new.erb +0 -297
- data/lib/starter_web/_data/modules/defaults/jekyll_search.yml +0 -151
- data/lib/starter_web/_data/modules/jekyll_search.yml +0 -33
@@ -1,234 +0,0 @@
|
|
1
|
-
<!doctype html>
|
2
|
-
<html lang="en">
|
3
|
-
|
4
|
-
<head>
|
5
|
-
<meta charset="utf-8">
|
6
|
-
<title>AuthManager</title>
|
7
|
-
<meta name="description" content="J1 Template">
|
8
|
-
<meta name="author" content="jelyll-one">
|
9
|
-
|
10
|
-
<link rel="stylesheet" type="text/css" href="/assets/themes/j1/core/css/uno.min.css">
|
11
|
-
<link rel="stylesheet" type="text/css" href="/assets/themes/j1/core/css/vendor.min.css">
|
12
|
-
<link rel="stylesheet" type="text/css" href="/assets/themes/j1/core/css/globals.min.css">
|
13
|
-
<script src="/assets/themes/j1/adapter/js/j1.js"></script>
|
14
|
-
</head>
|
15
|
-
|
16
|
-
<body class="r-text-300">
|
17
|
-
|
18
|
-
<!-- Modal Central Success -->
|
19
|
-
<div id="centralModalInfo" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
20
|
-
<div class="modal-dialog modal-notify modal-<%= @info_type %>" role="document">
|
21
|
-
<!-- Content -->
|
22
|
-
<div class="modal-content">
|
23
|
-
<!--Header-->
|
24
|
-
<div class="modal-header">
|
25
|
-
<p class="lead">
|
26
|
-
<i class="mdi mdi-2x mdi-dark mdi-<%= @modal_icon %>"></i>
|
27
|
-
<%= @modal_title %></p>
|
28
|
-
<!-- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
29
|
-
<i class="mdi mdi-dark mdi-48px mdi-close"></i>
|
30
|
-
</button> -->
|
31
|
-
</div>
|
32
|
-
<!-- Body -->
|
33
|
-
<div class="modal-body">
|
34
|
-
<div class="text-center">
|
35
|
-
<p style="text-align: justify"><%= @modal_description %></p>
|
36
|
-
</div>
|
37
|
-
</div>
|
38
|
-
<!-- Footer -->
|
39
|
-
<div class="modal-footer justify-content-center">
|
40
|
-
<a type="button" id="okButton" class="btn btn btn-raised btn-flex btn-md btn-info" data-dismiss="modal"><%= @modal_ok_text %></a>
|
41
|
-
</div>
|
42
|
-
</div>
|
43
|
-
<!-- END Content -->
|
44
|
-
</div>
|
45
|
-
</div>
|
46
|
-
<!-- END Central Success -->
|
47
|
-
|
48
|
-
<!-- Modal TopInfo -->
|
49
|
-
<div id="topInfo" class="modal fade top" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="false">
|
50
|
-
<div class="modal-dialog modal-frame modal-top modal-notify modal-info" role="document">
|
51
|
-
<!-- Content -->
|
52
|
-
<div class="modal-content">
|
53
|
-
|
54
|
-
<!-- Body -->
|
55
|
-
<div class="modal-body">
|
56
|
-
<div class="row px-4">
|
57
|
-
<p class="pt-1 pr-2"><%= @modal_description %></p>
|
58
|
-
</div>
|
59
|
-
<div class="row px-4">
|
60
|
-
<a type="button" id="okButton" class="btn btn btn-raised btn-flex btn-md btn-info" data-dismiss="modal"><%= @modal_ok_text %></a>
|
61
|
-
</div>
|
62
|
-
</div> <!-- END Body -->
|
63
|
-
|
64
|
-
</div>
|
65
|
-
<!-- END Content -->
|
66
|
-
</div>
|
67
|
-
</div>
|
68
|
-
<!-- END Modal TopInfo -->
|
69
|
-
|
70
|
-
<!-- Modal SignInProtectedContent -->
|
71
|
-
<div id="signInProtectedContent" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
72
|
-
<div class="modal-dialog modal-lg modal-notify modal-info" role="document">
|
73
|
-
<!-- Content -->
|
74
|
-
<div class="modal-content">
|
75
|
-
|
76
|
-
<!--Header-->
|
77
|
-
<div class="modal-header">
|
78
|
-
<p class="lead">
|
79
|
-
<i class="mdi mdi-2x mdi-dark mdi-account"></i>
|
80
|
-
<%= @modal_title %>
|
81
|
-
</p>
|
82
|
-
<!-- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
83
|
-
<i class="mdi mdi-dark mdi-48px mdi-close"></i>
|
84
|
-
</button> -->
|
85
|
-
</div>
|
86
|
-
|
87
|
-
<!-- Body -->
|
88
|
-
<div class="modal-body">
|
89
|
-
<div class="text-center">
|
90
|
-
<p style="text-align: justify"><%= @modal_description %></p>
|
91
|
-
</div>
|
92
|
-
<!-- img src="<%= @modal_image %>" alt="<%= @modal_title %>" class="img-fluid" -->
|
93
|
-
</div>
|
94
|
-
|
95
|
-
<!-- Footer -->
|
96
|
-
<div class="modal-footer justify-content-center">
|
97
|
-
<a type="button" id="signInButton" class="btn btn btn-raised btn-flex btn-md btn-info g-mr-5" data-dismiss="modal">
|
98
|
-
<i class="mdi mdi-18px mdi-dark mdi-login"></i>
|
99
|
-
<%= @modal_agreed_text %>
|
100
|
-
</a>
|
101
|
-
<a type="button" id="exitButton" class="btn btn btn-raised btn-flex btn-md btn-secondary" data-dismiss="modal">
|
102
|
-
<i class="mdi mdi-18px mdi-dark mdi-close"></i>
|
103
|
-
<%= @modal_disagreed_text %>
|
104
|
-
</a>
|
105
|
-
</div>
|
106
|
-
|
107
|
-
</div> <!-- END Content -->
|
108
|
-
</div>
|
109
|
-
</div>
|
110
|
-
<!-- END Modal SignInProtectedContent -->
|
111
|
-
|
112
|
-
</body>
|
113
|
-
|
114
|
-
<!--
|
115
|
-
# Loaded J1|JS resources late to not conflict with the IFFE J1 Adapter
|
116
|
-
# that creates the j1 object (window)
|
117
|
-
------------------------------------------------------------------------------ -->
|
118
|
-
<script src="/assets/themes/j1/core/js/template.js"></script>
|
119
|
-
|
120
|
-
<!--
|
121
|
-
# Dialog (modal) management
|
122
|
-
------------------------------------------------------------------------------ -->
|
123
|
-
<script>
|
124
|
-
var cookie_names = j1.getCookieNames();
|
125
|
-
var user_session = j1.readCookie(cookie_names.user_session);
|
126
|
-
var route = user_session.requested_page;
|
127
|
-
var provider;
|
128
|
-
var providerPermissions;
|
129
|
-
var categoryAllowed;
|
130
|
-
var logger;
|
131
|
-
|
132
|
-
// Collect $.selectors for all dialog (modal) buttons
|
133
|
-
// -------------------------------------------------------------------------
|
134
|
-
var allModalButtons = document.querySelectorAll('a.btn');
|
135
|
-
|
136
|
-
// -------------------------------------------------------------------------
|
137
|
-
// Initialize ACTION objects ALL modals
|
138
|
-
// -------------------------------------------------------------------------
|
139
|
-
var signIn = {
|
140
|
-
provider: "<%= @provider %>",
|
141
|
-
do: "na"
|
142
|
-
}
|
143
|
-
|
144
|
-
// Present dialog (modal)
|
145
|
-
// -------------------------------------------------------------------------
|
146
|
-
$(window).on('load', function() {
|
147
|
-
$("#<%= @modal %>").modal("show")
|
148
|
-
});
|
149
|
-
|
150
|
-
// -------------------------------------------------------------------------
|
151
|
-
// eventHandler ALL modals
|
152
|
-
// -------------------------------------------------------------------------
|
153
|
-
|
154
|
-
// Manage PRE SHOW events
|
155
|
-
// -------------------------------------------------------------------------
|
156
|
-
$(document).on('show.bs.modal','#<%= @modal %>', function () {
|
157
|
-
console.log('J1AuthManager: entered modal SHOW from <%= @modal %>');
|
158
|
-
});
|
159
|
-
|
160
|
-
|
161
|
-
console.log('J1AuthManager: entered modal SHOWN from <%= @modal %>');
|
162
|
-
|
163
|
-
allModalButtons.forEach(function(button, index) {
|
164
|
-
button.addEventListener('click', function() {
|
165
|
-
|
166
|
-
// Modal topInfo|centralModalInfo
|
167
|
-
// -------------------------------------------------------------------
|
168
|
-
if (this.id === "okButton") {
|
169
|
-
console.log('J1AuthManager: clicked OK button on modal: <%= @modal %>');
|
170
|
-
// route = user_session.previous_page;
|
171
|
-
// route = user_session.requested_page;
|
172
|
-
|
173
|
-
console.log('J1AuthManager: pass user to page: ' + route);
|
174
|
-
window.location.href = route;
|
175
|
-
}
|
176
|
-
|
177
|
-
// Modal SignInProtectedContent
|
178
|
-
// -------------------------------------------------------------------
|
179
|
-
if (this.id === "signInButton") {
|
180
|
-
console.log('J1AuthManager: clicked signInButton button on modal: <%= @modal %>');
|
181
|
-
signIn.do = true;
|
182
|
-
return;
|
183
|
-
} else {
|
184
|
-
signIn.do = false;
|
185
|
-
return;
|
186
|
-
}
|
187
|
-
|
188
|
-
});
|
189
|
-
});
|
190
|
-
|
191
|
-
return;
|
192
|
-
});
|
193
|
-
|
194
|
-
// -------------------------------------------------------------------------
|
195
|
-
// actionHandler ALL modals (HIDDEN event)
|
196
|
-
// process action objects
|
197
|
-
// -------------------------------------------------------------------------
|
198
|
-
// $(document).on('hide.bs.modal','#<%= @modal %>', function () {
|
199
|
-
$(document).on('hidden.bs.modal','#<%= @modal %>', function () {
|
200
|
-
console.log('J1AuthManager: entered modal HIDDEN from <%= @modal %>');
|
201
|
-
user_session = j1.readCookie(user_session_cookie_name);
|
202
|
-
|
203
|
-
// Manage SignIn actions
|
204
|
-
// -----------------------------------------------------------------------
|
205
|
-
if (signIn.do == true) {
|
206
|
-
// pass to authentication
|
207
|
-
route = "<%= @route %>"
|
208
|
-
} else if (signIn.do == false) {
|
209
|
-
// pass to (unchanged) current page
|
210
|
-
route = user_session.current_page;
|
211
|
-
} else {
|
212
|
-
route = user_session.current_page;
|
213
|
-
}
|
214
|
-
|
215
|
-
// Redirect detected route
|
216
|
-
// -----------------------------------------------------------------------
|
217
|
-
providerPermissions = user_session.provider_permissions;
|
218
|
-
providerPermissions.push('public');
|
219
|
-
categoryAllowed = providerPermissions.includes(user_session.page_permission);
|
220
|
-
|
221
|
-
// Make sure that protected pages are ALWAYS checked for permissions
|
222
|
-
// except on signIn
|
223
|
-
// -------------------------------------------------------------------
|
224
|
-
if (!categoryAllowed && !signIn.do) {
|
225
|
-
// pass to home page
|
226
|
-
route = '/';
|
227
|
-
}
|
228
|
-
console.log('J1AuthManager: pass to ' + route);
|
229
|
-
window.location.href = route;
|
230
|
-
|
231
|
-
});
|
232
|
-
</script>
|
233
|
-
|
234
|
-
</html>
|
@@ -1,297 +0,0 @@
|
|
1
|
-
<!doctype html>
|
2
|
-
<html lang="en">
|
3
|
-
|
4
|
-
<head>
|
5
|
-
<meta charset="utf-8">
|
6
|
-
<title>AuthManager</title>
|
7
|
-
<meta name="description" content="J1 Template">
|
8
|
-
<meta name="author" content="jelyll-one">
|
9
|
-
|
10
|
-
<link rel="stylesheet" type="text/css" href="/assets/themes/j1/core/css/uno.min.css">
|
11
|
-
<link rel="stylesheet" type="text/css" href="/assets/themes/j1/core/css/vendor.min.css">
|
12
|
-
<link rel="stylesheet" type="text/css" href="/assets/themes/j1/core/css/globals.min.css">
|
13
|
-
<script src="/assets/themes/j1/adapter/js/j1.js"></script>
|
14
|
-
</head>
|
15
|
-
|
16
|
-
<body class="r-text-300">
|
17
|
-
|
18
|
-
<!-- Modal Central Success -->
|
19
|
-
<div id="centralModalInfo" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
20
|
-
<div class="modal-dialog modal-notify modal-<%= @info_type %>" role="document">
|
21
|
-
<!-- Content -->
|
22
|
-
<div class="modal-content">
|
23
|
-
<!--Header-->
|
24
|
-
<div class="modal-header">
|
25
|
-
<p class="lead">
|
26
|
-
<i class="mdi mdi-2x mdi-dark mdi-<%= @modal_icon %>"></i>
|
27
|
-
<%= @modal_title %></p>
|
28
|
-
<!-- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
29
|
-
<i class="mdi mdi-dark mdi-48px mdi-close"></i>
|
30
|
-
</button> -->
|
31
|
-
</div>
|
32
|
-
<!-- Body -->
|
33
|
-
<div class="modal-body">
|
34
|
-
<div class="text-center">
|
35
|
-
<p style="text-align: justify"><%= @modal_description %></p>
|
36
|
-
</div>
|
37
|
-
</div>
|
38
|
-
<!-- Footer -->
|
39
|
-
<div class="modal-footer justify-content-center">
|
40
|
-
<a type="button" id="okButton" class="btn btn btn-raised btn-flex btn-md btn-info" data-dismiss="modal"><%= @modal_ok_text %></a>
|
41
|
-
</div>
|
42
|
-
</div>
|
43
|
-
<!-- END Content -->
|
44
|
-
</div>
|
45
|
-
</div>
|
46
|
-
<!-- END Central Success -->
|
47
|
-
|
48
|
-
<!-- Modal TopInfo -->
|
49
|
-
<div id="topInfo" class="modal fade top" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="false">
|
50
|
-
<div class="modal-dialog modal-frame modal-top modal-notify modal-info" role="document">
|
51
|
-
<!-- Content -->
|
52
|
-
<div class="modal-content">
|
53
|
-
|
54
|
-
<!-- Body -->
|
55
|
-
<div class="modal-body">
|
56
|
-
<div class="row px-4">
|
57
|
-
<p class="pt-1 pr-2"><%= @modal_description %></p>
|
58
|
-
</div>
|
59
|
-
<div class="row px-4">
|
60
|
-
<a type="button" id="okButton" class="btn btn btn-raised btn-flex btn-md btn-info" data-dismiss="modal"><%= @modal_ok_text %></a>
|
61
|
-
</div>
|
62
|
-
</div> <!-- END Body -->
|
63
|
-
|
64
|
-
</div>
|
65
|
-
<!-- END Content -->
|
66
|
-
</div>
|
67
|
-
</div>
|
68
|
-
<!-- END Modal TopInfo -->
|
69
|
-
|
70
|
-
<!-- Modal SignInProtectedContent -->
|
71
|
-
<div id="signInProtectedContent" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
72
|
-
<div class="modal-dialog modal-lg modal-notify modal-info" role="document">
|
73
|
-
<!-- Content -->
|
74
|
-
<div class="modal-content">
|
75
|
-
|
76
|
-
<!--Header-->
|
77
|
-
<div class="modal-header">
|
78
|
-
<p class="lead">
|
79
|
-
<i class="mdi mdi-2x mdi-dark mdi-account"></i>
|
80
|
-
<%= @modal_title %>
|
81
|
-
</p>
|
82
|
-
<!-- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
83
|
-
<i class="mdi mdi-dark mdi-48px mdi-close"></i>
|
84
|
-
</button> -->
|
85
|
-
</div>
|
86
|
-
|
87
|
-
<!-- Body -->
|
88
|
-
<div class="modal-body">
|
89
|
-
<div class="text-center">
|
90
|
-
<p style="text-align: justify"><%= @modal_description %></p>
|
91
|
-
</div>
|
92
|
-
<!-- img src="<%= @modal_image %>" alt="<%= @modal_title %>" class="img-fluid" -->
|
93
|
-
</div>
|
94
|
-
|
95
|
-
<!-- Footer -->
|
96
|
-
<div class="modal-footer justify-content-center">
|
97
|
-
<a type="button" id="signInButton" class="btn btn btn-raised btn-flex btn-md btn-info g-mr-5" data-dismiss="modal">
|
98
|
-
<i class="mdi mdi-18px mdi-dark mdi-login"></i>
|
99
|
-
<%= @modal_agreed_text %>
|
100
|
-
</a>
|
101
|
-
<a type="button" id="exitButton" class="btn btn btn-raised btn-flex btn-md btn-secondary" data-dismiss="modal">
|
102
|
-
<i class="mdi mdi-18px mdi-dark mdi-close"></i>
|
103
|
-
<%= @modal_disagreed_text %>
|
104
|
-
</a>
|
105
|
-
</div>
|
106
|
-
|
107
|
-
</div> <!-- END Content -->
|
108
|
-
</div>
|
109
|
-
</div>
|
110
|
-
<!-- END Modal SignInProtectedContent -->
|
111
|
-
|
112
|
-
</body>
|
113
|
-
|
114
|
-
<!--
|
115
|
-
# Loaded J1|JS resources late to not conflict with the IFFE J1 Adapter
|
116
|
-
# that creates the j1 object (window)
|
117
|
-
------------------------------------------------------------------------------ -->
|
118
|
-
<script src="/assets/themes/j1/core/js/template.js"></script>
|
119
|
-
|
120
|
-
<!--
|
121
|
-
# Dialog (modal) management
|
122
|
-
------------------------------------------------------------------------------ -->
|
123
|
-
<script>
|
124
|
-
var cookie_names = j1.getCookieNames();
|
125
|
-
const user_session_cookie_name = cookie_names.user_session;
|
126
|
-
var user_state = j1.readCookie(user_session_cookie_name);
|
127
|
-
var route = user_state.requested_page;
|
128
|
-
var provider;
|
129
|
-
var providerPermissions;
|
130
|
-
var categoryAllowed;
|
131
|
-
var user_state;
|
132
|
-
var logger;
|
133
|
-
|
134
|
-
// Collect $.selectors for all dialog (modal) buttons
|
135
|
-
// -------------------------------------------------------------------------
|
136
|
-
var allModalButtons = document.querySelectorAll('a.btn');
|
137
|
-
|
138
|
-
// -------------------------------------------------------------------------
|
139
|
-
// Initialize ACTION objects ALL modals
|
140
|
-
// -------------------------------------------------------------------------
|
141
|
-
var signIn = {
|
142
|
-
provider: "<%= @provider %>",
|
143
|
-
do: "disabled"
|
144
|
-
}
|
145
|
-
var passBack = {
|
146
|
-
provider: "<%= @provider %>",
|
147
|
-
do: "disabled"
|
148
|
-
}
|
149
|
-
|
150
|
-
// Present dialog (modal)
|
151
|
-
// -------------------------------------------------------------------------
|
152
|
-
$(window).on('load', function() {
|
153
|
-
$("#<%= @modal %>").modal("show")
|
154
|
-
});
|
155
|
-
|
156
|
-
// -------------------------------------------------------------------------
|
157
|
-
// eventHandler ALL modals
|
158
|
-
// -------------------------------------------------------------------------
|
159
|
-
|
160
|
-
// Manage PRE SHOW events
|
161
|
-
// -------------------------------------------------------------------------
|
162
|
-
$(document).on('show.bs.modal','#<%= @modal %>', function () {
|
163
|
-
console.log('J1AuthManager: entered modal SHOW from <%= @modal %>');
|
164
|
-
});
|
165
|
-
|
166
|
-
// Manage POST SHOW events (button click events)
|
167
|
-
// -------------------------------------------------------------------------
|
168
|
-
$(document).on('shown.bs.modal','#<%= @modal %>', function () {
|
169
|
-
console.log('J1AuthManager: entered modal SHOWN from <%= @modal %>');
|
170
|
-
|
171
|
-
allModalButtons.forEach(function(button, index) {
|
172
|
-
button.addEventListener('click', function() {
|
173
|
-
|
174
|
-
// Modal topInfo|centralModalInfo
|
175
|
-
// -------------------------------------------------------------------
|
176
|
-
if (this.id === 'okButton') {
|
177
|
-
console.log('J1AuthManager: clicked OK button on modal: <%= @modal %>');
|
178
|
-
// jadams, 2019-09-06: to be clarified why 'route' is
|
179
|
-
// 'requested_page' but not 'previous_page'
|
180
|
-
// route = user_state.previous_page;
|
181
|
-
// route = user_state.requested_page;
|
182
|
-
// jadams, 2019-09-06: seems needed to read the cookie
|
183
|
-
// setTimeout(function () {
|
184
|
-
// window.location.replace = user_state.previous_page;
|
185
|
-
// }, 100 );
|
186
|
-
signIn.do = false;
|
187
|
-
}
|
188
|
-
|
189
|
-
// Modal SignInProtectedContent
|
190
|
-
// -------------------------------------------------------------------
|
191
|
-
if (this.id === 'signInButton') {
|
192
|
-
console.log('J1AuthManager: user clicked signInButton button on modal: <%= @modal %>');
|
193
|
-
signIn.do = true;
|
194
|
-
// return;
|
195
|
-
}
|
196
|
-
|
197
|
-
if (this.id === 'exitButton') {
|
198
|
-
console.log('J1AuthManager: user clicked exitButton button on modal: <%= @modal %>');
|
199
|
-
passBack.do = true;
|
200
|
-
// route = user_state.previous_page;
|
201
|
-
// window.location.href = route;
|
202
|
-
//return;
|
203
|
-
} else {
|
204
|
-
console.log('J1AuthManager: user clicked NO button on modal: <%= @modal %>');
|
205
|
-
console.log('J1AuthManager: set default action on modal <%= @modal %> to: passBack');
|
206
|
-
passBack.do = true;
|
207
|
-
}
|
208
|
-
|
209
|
-
});
|
210
|
-
});
|
211
|
-
|
212
|
-
return;
|
213
|
-
});
|
214
|
-
|
215
|
-
// -------------------------------------------------------------------------
|
216
|
-
// actionHandler ALL modals (HIDDEN event)
|
217
|
-
// process action objects
|
218
|
-
// -------------------------------------------------------------------------
|
219
|
-
// $(document).on('hide.bs.modal','#<%= @modal %>', function () {
|
220
|
-
$(document).on('hidden.bs.modal','#<%= @modal %>', function () {
|
221
|
-
var current_page = window.location.href;
|
222
|
-
var providerPermissions = [];
|
223
|
-
var pagePermission = 'na';
|
224
|
-
var categoryAllowed;
|
225
|
-
var user_session;
|
226
|
-
|
227
|
-
|
228
|
-
console.log('J1AuthManager: entered modal HIDDEN from <%= @modal %>');
|
229
|
-
console.log('J1AuthManager: current page detected as: ' + current_page);
|
230
|
-
|
231
|
-
user_session = j1.readCookie(user_session_cookie_name);
|
232
|
-
providerPermissions = user_session.provider_permissions;
|
233
|
-
|
234
|
-
if (providerPermissions.indexOf('public') > -1) {
|
235
|
-
console.log('J1AuthManager: current provider permissions contains: public');
|
236
|
-
} else {
|
237
|
-
console.log('J1AuthManager: add missing provider permission: public');
|
238
|
-
providerPermissions.push('public');
|
239
|
-
}
|
240
|
-
|
241
|
-
if (user_session.requested_page === '/') {
|
242
|
-
pagePermission = 'public';
|
243
|
-
} else if (user_session.requested_page.indexOf('public') > -1) {
|
244
|
-
pagePermission = 'public';
|
245
|
-
} else if (user_session.requested_page.indexOf('protected') > -1) {
|
246
|
-
pagePermission = 'protected';
|
247
|
-
} if (user_session.requested_page.indexOf('private') > -1) {
|
248
|
-
pagePermission = 'private';
|
249
|
-
}
|
250
|
-
|
251
|
-
categoryAllowed = providerPermissions.includes(pagePermission);
|
252
|
-
|
253
|
-
console.log('J1AuthManager: provider permissions detected: ' + providerPermissions);
|
254
|
-
console.log('J1AuthManager: page permissions detected: ' + pagePermission);
|
255
|
-
console.log('J1AuthManager: category allowed: ' + categoryAllowed);
|
256
|
-
|
257
|
-
// Manage actions
|
258
|
-
// -----------------------------------------------------------------------
|
259
|
-
if (signIn.do == true) {
|
260
|
-
// pass to authentication
|
261
|
-
route = "<%= @route %>"
|
262
|
-
} else if (signIn.do == false) {
|
263
|
-
// pass to (unchanged) current page
|
264
|
-
route = user_state.current_page;
|
265
|
-
} else if (passBack.do == true) {
|
266
|
-
// calculate possible route to pass
|
267
|
-
route = categoryAllowed ? user_state.requested_page : user_state.current_page;
|
268
|
-
} else {
|
269
|
-
// Modal closed w/o clear action, default route calculated|taken
|
270
|
-
console.warn('J1AuthManager: no action detected');
|
271
|
-
route = categoryAllowed ? user_state.requested_page : user_state.current_page;
|
272
|
-
}
|
273
|
-
|
274
|
-
// Redirect detected route
|
275
|
-
// -----------------------------------------------------------------------
|
276
|
-
// providerPermissions = user_state.provider_permissions;
|
277
|
-
// providerPermissions.push('public');
|
278
|
-
// categoryAllowed = providerPermissions.includes(user_state.page_permission);
|
279
|
-
|
280
|
-
// Make sure that protected pages are ALWAYS checked for permissions
|
281
|
-
// except on signIn
|
282
|
-
// -------------------------------------------------------------------
|
283
|
-
// if (!categoryAllowed && !signIn.do) {
|
284
|
-
// // pass to home page
|
285
|
-
// route = '/';
|
286
|
-
// }
|
287
|
-
|
288
|
-
// Redirect detected route
|
289
|
-
// -----------------------------------------------------------------------
|
290
|
-
console.log('J1AuthManager: pass to route: ' + route);
|
291
|
-
// window.location.href = route;
|
292
|
-
location.replace(route);
|
293
|
-
|
294
|
-
});
|
295
|
-
</script>
|
296
|
-
|
297
|
-
</html>
|