pseudo_kiosk 0.1.1 → 0.1.3
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 +4 -4
- data/README.md +1 -1
- data/app/assets/config/pseudo_kiosk_manifest.js +1 -0
- data/app/assets/stylesheets/pseudo_kiosk/authentication.css +148 -4
- data/app/views/pseudo_kiosk/authentication/unlock.html.erb +105 -256
- data/lib/pseudo_kiosk.rb +0 -2
- data/lib/pseudo_kiosk/config.rb +1 -11
- data/lib/pseudo_kiosk/test_helpers/internal/rails.rb +1 -9
- data/lib/pseudo_kiosk/version.rb +1 -1
- metadata +2 -3
- data/lib/pseudo_kiosk/test_helpers/internal.rb +0 -79
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 312199a0ab0c50594d1f4b644dd3ca75db93c0cb4c56ca6ae5518491fd7d42b6
|
4
|
+
data.tar.gz: 9d1c48552289cc78d0c6d85484f607531319a42e626a453ddd67802f5fac4cad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12772105e9b2278110ec151429c67c20cfdf50c4a68aeec92325b13125c5ed5db81aa7b7a6b3696f2808206d89a3b275e37e1f4bb0278fd4544969c57f362aea
|
7
|
+
data.tar.gz: 6ddc8955a7dcfb5fc561e7a88797ecb3d8828c9f5a46f0d6f02f3f6f21e2c58ddd0186d350f984f62c3c6633cf5c6b9359c0823fcb1076561c8cde3851443bea
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# PseudoKiosk
|
2
2
|
|
3
|
-

|
3
|
+
[](https://travis-ci.org/jonmchan/pseudo_kiosk/) [](https://coveralls.io/github/jonmchan/pseudo_kiosk?branch=master) [](https://rubygems.org/gems/pseudo_kiosk) [](https://opensource.org/licenses/MIT)
|
4
4
|
|
5
5
|
PseudoKiosk is a play on words on the unix sudo command and the idea to provide a fake kiosk terminal. Instead of granting elevated privileges, PseudoKiosk gives the ability to limit access to the application during workflows which involve physically passing a device with elevated permissions to an unknown or untrusted user. PseudoKiosk provides the ability to lock down a rails application to only a specified whitelist of endpoints during a session. The kiosk can be quickly and easily unlocked by passing a kiosk passcode.
|
6
6
|
|
@@ -1,4 +1,148 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
html {
|
2
|
+
font-size: 32px;
|
3
|
+
text-align: center;
|
4
|
+
}
|
5
|
+
.explanation-window__pullee {
|
6
|
+
width: 10rem;
|
7
|
+
appearance: none;
|
8
|
+
}
|
9
|
+
.explanation-window__pullee:active::-webkit-slider-thumb {
|
10
|
+
appearance: none;
|
11
|
+
transform: scale(1.1);
|
12
|
+
cursor: -webkit-grabbing;
|
13
|
+
cursor: -moz-grabbing;
|
14
|
+
}
|
15
|
+
.explanation-window__pullee:active::-moz-range-thumb {
|
16
|
+
border: 0;
|
17
|
+
transform: scale(1.1);
|
18
|
+
cursor: -webkit-grabbing;
|
19
|
+
cursor: -moz-grabbing;
|
20
|
+
}
|
21
|
+
.explanation-window__pullee:active::-ms-thumb {
|
22
|
+
transform: scale(1.1);
|
23
|
+
cursor: -webkit-grabbing;
|
24
|
+
cursor: -moz-grabbing;
|
25
|
+
}
|
26
|
+
.explanation-window__pullee:focus {
|
27
|
+
outline: none;
|
28
|
+
}
|
29
|
+
.explanation-window__pullee::-webkit-slider-thumb {
|
30
|
+
appearance: none;
|
31
|
+
display: block;
|
32
|
+
width: 1rem;
|
33
|
+
height: 1rem;
|
34
|
+
border-radius: 50%;
|
35
|
+
background: #5990DD;
|
36
|
+
transform-origin: 50% 50%;
|
37
|
+
transform: scale(1);
|
38
|
+
transition: transform ease-out 100ms;
|
39
|
+
cursor: -webkit-grab;
|
40
|
+
cursor: -moz-grab;
|
41
|
+
}
|
42
|
+
.explanation-window__pullee::-moz-range-thumb {
|
43
|
+
border: 0;
|
44
|
+
display: block;
|
45
|
+
width: 1rem;
|
46
|
+
height: 1rem;
|
47
|
+
border-radius: 50%;
|
48
|
+
background: #5990DD;
|
49
|
+
transform-origin: 50% 50%;
|
50
|
+
transform: scale(1);
|
51
|
+
transition: transform ease-out 100ms;
|
52
|
+
cursor: -webkit-grab;
|
53
|
+
cursor: -moz-grab;
|
54
|
+
}
|
55
|
+
.explanation-window__pullee::-ms-thumb {
|
56
|
+
display: block;
|
57
|
+
width: 1rem;
|
58
|
+
height: 1rem;
|
59
|
+
border-radius: 50%;
|
60
|
+
background: #5990DD;
|
61
|
+
transform-origin: 50% 50%;
|
62
|
+
transform: scale(1);
|
63
|
+
transition: transform ease-out 100ms;
|
64
|
+
cursor: -webkit-grab;
|
65
|
+
cursor: -moz-grab;
|
66
|
+
}
|
67
|
+
.explanation-window__pullee::-webkit-slider-runnable-track {
|
68
|
+
height: 1rem;
|
69
|
+
padding: .25rem;
|
70
|
+
box-sizing: content-box;
|
71
|
+
border-radius: 1rem;
|
72
|
+
background-color: #DDE0E3;
|
73
|
+
}
|
74
|
+
.explanation-window__pullee::-moz-range-track {
|
75
|
+
height: 1rem;
|
76
|
+
padding: .25rem;
|
77
|
+
box-sizing: content-box;
|
78
|
+
border-radius: 1rem;
|
79
|
+
background-color: #DDE0E3;
|
80
|
+
}
|
81
|
+
.explanation-window__pullee::-moz-focus-outer {
|
82
|
+
border: 0;
|
83
|
+
}
|
84
|
+
.explanation-window__pullee::-ms-track {
|
85
|
+
border: 0;
|
86
|
+
height: 1rem;
|
87
|
+
padding: .25rem;
|
88
|
+
box-sizing: content-box;
|
89
|
+
border-radius: 1rem;
|
90
|
+
background-color: #DDE0E3;
|
91
|
+
color: transparent;
|
92
|
+
}
|
93
|
+
.explanation-window__pullee::-ms-fill-lower,
|
94
|
+
.explanation-window__pullee::-ms-fill-upper {
|
95
|
+
background-color: transparent;
|
96
|
+
}
|
97
|
+
.explanation-window__pullee::-ms-tooltip {
|
98
|
+
display: none;
|
99
|
+
}
|
100
|
+
.explanation-window__header,
|
101
|
+
.explanation-window__unlock_instruction,
|
102
|
+
.pass-window__passcode {
|
103
|
+
font-size: 0.8rem;
|
104
|
+
text-transform: uppercase;
|
105
|
+
letter-spacing: 1.25px;
|
106
|
+
}
|
107
|
+
.explanation-window__subheader {
|
108
|
+
font-size: 0.6rem;
|
109
|
+
text-transform: uppercase;
|
110
|
+
letter-spacing: 1.25px;
|
111
|
+
}
|
112
|
+
.pass-window__input {
|
113
|
+
text-align: center;
|
114
|
+
}
|
115
|
+
.pass-window__submit {
|
116
|
+
font-size: 0.8rem;
|
117
|
+
text-transform: uppercase;
|
118
|
+
letter-spacing: 1.25px;
|
119
|
+
margin: .65em;
|
120
|
+
}
|
121
|
+
.unlock {
|
122
|
+
position: absolute;
|
123
|
+
top: 50%;
|
124
|
+
left: 50%;
|
125
|
+
transform: translate(-50%, -50%);
|
126
|
+
}
|
127
|
+
.unlock .unlock__pass-window {
|
128
|
+
display: none;
|
129
|
+
}
|
130
|
+
.unlock .pass-window__invalid {
|
131
|
+
display: none;
|
132
|
+
}
|
133
|
+
.unlock .unlock__explanation-window {
|
134
|
+
display: initial;
|
135
|
+
}
|
136
|
+
.unlock--failed .unlock__explanation-window {
|
137
|
+
display: none;
|
138
|
+
}
|
139
|
+
.unlock--failed .unlock__pass-window {
|
140
|
+
display: initial;
|
141
|
+
}
|
142
|
+
.unlock--failed .pass-window__invalid {
|
143
|
+
display: initial;
|
144
|
+
font-size: 0.55rem;
|
145
|
+
color: red;
|
146
|
+
text-transform: uppercase;
|
147
|
+
letter-spacing: 1.25px;
|
148
|
+
}
|
@@ -1,260 +1,109 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="UTF-8">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width">
|
5
6
|
|
6
|
-
<%= csrf_meta_tags %>
|
7
|
-
<%= csp_meta_tag %>
|
8
|
-
<title>Operator Unlock</title>
|
9
|
-
|
10
|
-
<meta name="viewport" content="width=device-width">
|
11
|
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
|
12
|
-
|
13
|
-
<style>
|
14
|
-
.pullee {
|
15
|
-
width: 10rem;
|
16
|
-
appearance: none;
|
17
|
-
}
|
18
|
-
.pullee:active::-webkit-slider-thumb {
|
19
|
-
appearance: none;
|
20
|
-
transform: scale(1.1);
|
21
|
-
cursor: -webkit-grabbing;
|
22
|
-
cursor: -moz-grabbing;
|
23
|
-
}
|
24
|
-
.pullee:active::-moz-range-thumb {
|
25
|
-
border: 0;
|
26
|
-
transform: scale(1.1);
|
27
|
-
cursor: -webkit-grabbing;
|
28
|
-
cursor: -moz-grabbing;
|
29
|
-
}
|
30
|
-
.pullee:active::-ms-thumb {
|
31
|
-
transform: scale(1.1);
|
32
|
-
cursor: -webkit-grabbing;
|
33
|
-
cursor: -moz-grabbing;
|
34
|
-
}
|
35
|
-
.pullee:focus {
|
36
|
-
outline: none;
|
37
|
-
}
|
38
|
-
.pullee::-webkit-slider-thumb {
|
39
|
-
appearance: none;
|
40
|
-
display: block;
|
41
|
-
width: 1rem;
|
42
|
-
height: 1rem;
|
43
|
-
border-radius: 50%;
|
44
|
-
background: #5990DD;
|
45
|
-
transform-origin: 50% 50%;
|
46
|
-
transform: scale(1);
|
47
|
-
transition: transform ease-out 100ms;
|
48
|
-
cursor: -webkit-grab;
|
49
|
-
cursor: -moz-grab;
|
50
|
-
}
|
51
|
-
.pullee::-moz-range-thumb {
|
52
|
-
border: 0;
|
53
|
-
display: block;
|
54
|
-
width: 1rem;
|
55
|
-
height: 1rem;
|
56
|
-
border-radius: 50%;
|
57
|
-
background: #5990DD;
|
58
|
-
transform-origin: 50% 50%;
|
59
|
-
transform: scale(1);
|
60
|
-
transition: transform ease-out 100ms;
|
61
|
-
cursor: -webkit-grab;
|
62
|
-
cursor: -moz-grab;
|
63
|
-
}
|
64
|
-
.pullee::-ms-thumb {
|
65
|
-
display: block;
|
66
|
-
width: 1rem;
|
67
|
-
height: 1rem;
|
68
|
-
border-radius: 50%;
|
69
|
-
background: #5990DD;
|
70
|
-
transform-origin: 50% 50%;
|
71
|
-
transform: scale(1);
|
72
|
-
transition: transform ease-out 100ms;
|
73
|
-
cursor: -webkit-grab;
|
74
|
-
cursor: -moz-grab;
|
75
|
-
}
|
76
|
-
.pullee::-webkit-slider-runnable-track {
|
77
|
-
height: 1rem;
|
78
|
-
padding: .25rem;
|
79
|
-
box-sizing: content-box;
|
80
|
-
border-radius: 1rem;
|
81
|
-
background-color: #DDE0E3;
|
82
|
-
}
|
83
|
-
.pullee::-moz-range-track {
|
84
|
-
height: 1rem;
|
85
|
-
padding: .25rem;
|
86
|
-
box-sizing: content-box;
|
87
|
-
border-radius: 1rem;
|
88
|
-
background-color: #DDE0E3;
|
89
|
-
}
|
90
|
-
.pullee::-moz-focus-outer {
|
91
|
-
border: 0;
|
92
|
-
}
|
93
|
-
.pullee::-ms-track {
|
94
|
-
border: 0;
|
95
|
-
height: 1rem;
|
96
|
-
padding: .25rem;
|
97
|
-
box-sizing: content-box;
|
98
|
-
border-radius: 1rem;
|
99
|
-
background-color: #DDE0E3;
|
100
|
-
color: transparent;
|
101
|
-
}
|
102
|
-
.pullee::-ms-fill-lower, .pullee::-ms-fill-upper {
|
103
|
-
background-color: transparent;
|
104
|
-
}
|
105
|
-
.pullee::-ms-tooltip {
|
106
|
-
display: none;
|
107
|
-
}
|
108
|
-
|
109
|
-
html {
|
110
|
-
font-size: 32px;
|
111
|
-
text-align: center;
|
112
|
-
}
|
113
|
-
|
114
|
-
h1 {
|
115
|
-
font-size: 0.8rem;
|
116
|
-
text-transform: uppercase;
|
117
|
-
letter-spacing: 1.25px;
|
118
|
-
}
|
119
|
-
|
120
|
-
h2 {
|
121
|
-
font-size: 0.6rem;
|
122
|
-
text-transform: uppercase;
|
123
|
-
letter-spacing: 1.25px;
|
124
|
-
}
|
125
|
-
|
126
|
-
input[type=submit] {
|
127
|
-
font-size: 0.8rem;
|
128
|
-
text-transform: uppercase;
|
129
|
-
letter-spacing: 1.25px;
|
130
|
-
margin: .65em;
|
131
|
-
}
|
132
|
-
|
133
|
-
.center-xy {
|
134
|
-
position: absolute;
|
135
|
-
top: 50%;
|
136
|
-
left: 50%;
|
137
|
-
transform: translate(-50%, -50%);
|
138
|
-
}
|
139
|
-
|
140
|
-
<% if params[:failed] %>
|
141
|
-
#pass_window {
|
142
|
-
display: initial;
|
143
|
-
}
|
144
|
-
#invalid {
|
145
|
-
display: initial;
|
146
|
-
font-size: 0.55rem;
|
147
|
-
color: red;
|
148
|
-
text-transform: uppercase;
|
149
|
-
letter-spacing: 1.25px;
|
150
|
-
}
|
151
|
-
|
152
|
-
#explanation_window {
|
153
|
-
display: none;
|
154
|
-
}
|
155
|
-
<% else %>
|
156
|
-
#pass_window {
|
157
|
-
display: none;
|
158
|
-
}
|
159
|
-
#invalid {
|
160
|
-
display: none;
|
161
|
-
}
|
162
|
-
|
163
|
-
#explanation_window {
|
164
|
-
display: initial;
|
165
|
-
}
|
166
|
-
<% end %>
|
167
|
-
</style>
|
168
|
-
<script>
|
169
|
-
window.console = window.console || function(t) {};
|
170
|
-
</script>
|
171
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
|
172
|
-
<script>
|
173
|
-
if (document.location.search.match(/type=embed/gi)) {
|
174
|
-
window.parent.postMessage("resize", "*");
|
175
|
-
}
|
176
|
-
</script>
|
177
|
-
</head>
|
178
|
-
|
179
|
-
<body translate="no">
|
180
|
-
<div id="explanation_window" class="center-xy">
|
181
|
-
<h1>Thank you for your input!</h1>
|
182
|
-
<h2>Please pass the device back to the operator</h2>
|
183
|
-
<h1>Slide to Unlock</h1>
|
184
|
-
<input type="range" value="0" class="pullee" />
|
185
|
-
</div>
|
186
|
-
<% # This is bad... I am having a problem using the named routes within the rails engine plugin %>
|
187
|
-
<%= form_tag 'process_submit', authenticity_token: false do %>
|
188
|
-
<%= hidden_field_tag :authenticity_token, form_authenticity_token -%>
|
189
|
-
<div id="pass_window" class="center-xy">
|
190
|
-
<h1>Passcode:</h1>
|
191
|
-
<div id="invalid">Invalid Passcode! Please try again.</div>
|
192
|
-
<div><input type="password" name="passcode" style="text-align: center;"></div>
|
193
|
-
<div><input type="submit"></div>
|
194
|
-
<% end %>
|
195
|
-
</div>
|
196
|
-
<script id="rendered-js">
|
197
|
-
var inputRange = document.getElementsByClassName('pullee')[0],
|
198
|
-
maxValue = 150, // the higher the smoother when dragging
|
199
|
-
speed = 12, // thanks to @pixelass for this
|
200
|
-
currValue, rafID;
|
201
|
-
|
202
|
-
// set min/max value
|
203
|
-
inputRange.min = 0;
|
204
|
-
inputRange.max = maxValue;
|
205
|
-
|
206
|
-
// listen for unlock
|
207
|
-
function unlockStartHandler() {
|
208
|
-
// clear raf if trying again
|
209
|
-
window.cancelAnimationFrame(rafID);
|
210
|
-
|
211
|
-
// set to desired value
|
212
|
-
currValue = +this.value;
|
213
|
-
}
|
214
|
-
|
215
|
-
function unlockEndHandler() {
|
216
|
-
|
217
|
-
// store current value
|
218
|
-
currValue = +this.value;
|
219
|
-
|
220
|
-
// determine if we have reached success or not
|
221
|
-
if(currValue >= maxValue) {
|
222
|
-
successHandler();
|
223
|
-
}
|
224
|
-
else {
|
225
|
-
rafID = window.requestAnimationFrame(animateHandler);
|
226
|
-
}
|
227
|
-
}
|
228
|
-
|
229
|
-
// handle range animation
|
230
|
-
function animateHandler() {
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
<%= csp_meta_tag %>
|
231
9
|
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
10
|
+
<title>Operator Unlock</title>
|
11
|
+
|
12
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
|
13
|
+
<%= stylesheet_link_tag "pseudo_kiosk/application", media: "all" %>
|
14
|
+
|
15
|
+
<script>
|
16
|
+
window.console = window.console || function(t) {};
|
17
|
+
</script>
|
18
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
|
19
|
+
<script>
|
20
|
+
if (document.location.search.match(/type=embed/gi)) {
|
21
|
+
window.parent.postMessage("resize", "*");
|
22
|
+
}
|
23
|
+
</script>
|
24
|
+
</head>
|
25
|
+
<body translate="no">
|
26
|
+
<div class="unlock <%= params[:failed] && 'unlock--failed' %>">
|
27
|
+
<div id="explanation_window" class="unlock__explanation-window">
|
28
|
+
<h1 class="explanation-window__header">Thank you for your input!</h1>
|
29
|
+
<h2 class="explanation-window__subheader">Please pass the device back to the operator</h2>
|
30
|
+
<h1 class="explanation-window__unlock_instruction">Slide to Unlock</h1>
|
31
|
+
<input type="range" value="0" class="explanation-window__pullee" />
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<div id="pass_window" class="unlock__pass-window">
|
35
|
+
<%= form_tag 'process_submit', authenticity_token: false do %>
|
36
|
+
<%= hidden_field_tag :authenticity_token, form_authenticity_token -%>
|
37
|
+
<h1 class="pass-window__passcode">Passcode:</h1>
|
38
|
+
<div id="invalid" class="pass-window__invalid">Invalid Passcode! Please try again.</div>
|
39
|
+
<div><input class="pass-window__input" type="password" name="passcode"></div>
|
40
|
+
<div><input class="pass-window__submit" type="submit"></div>
|
41
|
+
<% end %>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<script id="rendered-js">
|
46
|
+
var inputRange = document.getElementsByClassName('explanation-window__pullee')[0],
|
47
|
+
maxValue = 150, // the higher the smoother when dragging
|
48
|
+
speed = 12, // thanks to @pixelass for this
|
49
|
+
currValue, rafID;
|
50
|
+
|
51
|
+
// set min/max value
|
52
|
+
inputRange.min = 0;
|
53
|
+
inputRange.max = maxValue;
|
54
|
+
|
55
|
+
// listen for unlock
|
56
|
+
function unlockStartHandler() {
|
57
|
+
// clear raf if trying again
|
58
|
+
window.cancelAnimationFrame(rafID);
|
59
|
+
|
60
|
+
// set to desired value
|
61
|
+
currValue = +this.value;
|
62
|
+
}
|
63
|
+
|
64
|
+
function unlockEndHandler() {
|
65
|
+
|
66
|
+
// store current value
|
67
|
+
currValue = +this.value;
|
68
|
+
|
69
|
+
// determine if we have reached success or not
|
70
|
+
if(currValue >= maxValue) {
|
71
|
+
successHandler();
|
72
|
+
}
|
73
|
+
else {
|
74
|
+
rafID = window.requestAnimationFrame(animateHandler);
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
// handle range animation
|
79
|
+
function animateHandler() {
|
80
|
+
|
81
|
+
// update input range
|
82
|
+
inputRange.value = currValue;
|
83
|
+
|
84
|
+
// determine if we need to continue
|
85
|
+
if(currValue > -1) {
|
86
|
+
window.requestAnimationFrame(animateHandler);
|
87
|
+
}
|
88
|
+
|
89
|
+
// decrement value
|
90
|
+
currValue = currValue - speed;
|
91
|
+
}
|
92
|
+
|
93
|
+
// handle successful unlock
|
94
|
+
function successHandler() {
|
95
|
+
document.getElementById("pass_window").style.display = "block";
|
96
|
+
document.getElementById("explanation_window").style.display = "none";
|
97
|
+
|
98
|
+
// reset input range
|
99
|
+
inputRange.value = 0;
|
100
|
+
};
|
101
|
+
|
102
|
+
// bind events
|
103
|
+
inputRange.addEventListener('mousedown', unlockStartHandler, false);
|
104
|
+
inputRange.addEventListener('mousestart', unlockStartHandler, false);
|
105
|
+
inputRange.addEventListener('mouseup', unlockEndHandler, false);
|
106
|
+
inputRange.addEventListener('touchend', unlockEndHandler, false);
|
107
|
+
</script>
|
108
|
+
</body>
|
109
|
+
</html>
|
data/lib/pseudo_kiosk.rb
CHANGED
data/lib/pseudo_kiosk/config.rb
CHANGED
@@ -20,19 +20,9 @@ module PseudoKiosk
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
def update!
|
24
|
-
@defaults.each do |k, v|
|
25
|
-
instance_variable_set(k, v) unless instance_variable_defined?(k)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def user_config(&blk)
|
30
|
-
block_given? ? @user_config = blk : @user_config
|
31
|
-
end
|
32
|
-
|
33
23
|
def configure(&blk)
|
34
24
|
@configure_blk = blk
|
35
|
-
|
25
|
+
configure!
|
36
26
|
end
|
37
27
|
|
38
28
|
def configure!
|
@@ -8,15 +8,7 @@ module PseudoKiosk
|
|
8
8
|
|
9
9
|
ActionController::Base.send(:include, PseudoKiosk::Controller)
|
10
10
|
end
|
11
|
-
|
12
|
-
def pseudo_kiosk_config_property_set(property, value)
|
13
|
-
::PseudoKiosk::Config.send(:"#{property}=", value)
|
14
|
-
end
|
15
|
-
|
16
|
-
# def pseudo_kiosk_config_external_property_set(provider, property, value)
|
17
|
-
# ::PseudoKiosk::Config.send(provider).send(:"#{property}=", value)
|
18
|
-
# end
|
19
11
|
end
|
20
12
|
end
|
21
13
|
end
|
22
|
-
end
|
14
|
+
end
|
data/lib/pseudo_kiosk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pseudo_kiosk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Chan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -95,7 +95,6 @@ files:
|
|
95
95
|
- lib/pseudo_kiosk/config.rb
|
96
96
|
- lib/pseudo_kiosk/controller.rb
|
97
97
|
- lib/pseudo_kiosk/engine.rb
|
98
|
-
- lib/pseudo_kiosk/test_helpers/internal.rb
|
99
98
|
- lib/pseudo_kiosk/test_helpers/internal/rails.rb
|
100
99
|
- lib/pseudo_kiosk/version.rb
|
101
100
|
- lib/tasks/pseudo_kiosk_tasks.rake
|
@@ -1,79 +0,0 @@
|
|
1
|
-
module PseudoKiosk
|
2
|
-
module TestHelpers
|
3
|
-
# Internal TestHelpers are used to test the gem, internally, and should not be used to test apps *using* sorcery.
|
4
|
-
# This file will be included in the spec_helper file.
|
5
|
-
module Internal
|
6
|
-
def self.included(_base)
|
7
|
-
# # reducing default cost for specs speed
|
8
|
-
# CryptoProviders::BCrypt.class_eval do
|
9
|
-
# class << self
|
10
|
-
# def cost
|
11
|
-
# 1
|
12
|
-
# end
|
13
|
-
# end
|
14
|
-
# end
|
15
|
-
end
|
16
|
-
|
17
|
-
# a patch to fix a bug in testing that happens when you 'destroy' a session twice.
|
18
|
-
# After the first destroy, the session is an ordinary hash, and then when destroy
|
19
|
-
# is called again there's an exception.
|
20
|
-
class ::Hash # rubocop:disable Style/ClassAndModuleChildren
|
21
|
-
def destroy
|
22
|
-
clear
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def build_new_user(attributes_hash = nil)
|
27
|
-
user_attributes_hash = attributes_hash || { username: 'gizmo', email: 'bla@bla.com', password: 'secret' }
|
28
|
-
@user = User.new(user_attributes_hash)
|
29
|
-
end
|
30
|
-
|
31
|
-
def create_new_user(attributes_hash = nil)
|
32
|
-
@user = build_new_user(attributes_hash)
|
33
|
-
@user.sorcery_adapter.save(raise_on_failure: true)
|
34
|
-
@user
|
35
|
-
end
|
36
|
-
|
37
|
-
def create_new_external_user(provider, attributes_hash = nil)
|
38
|
-
user_attributes_hash = attributes_hash || { username: 'gizmo' }
|
39
|
-
@user = User.new(user_attributes_hash)
|
40
|
-
@user.sorcery_adapter.save(raise_on_failure: true)
|
41
|
-
@user.authentications.create!(provider: provider, uid: 123)
|
42
|
-
@user
|
43
|
-
end
|
44
|
-
|
45
|
-
def custom_create_new_external_user(provider, authentication_class, attributes_hash = nil)
|
46
|
-
authentication_association = authentication_class.name.underscore.pluralize
|
47
|
-
|
48
|
-
user_attributes_hash = attributes_hash || { username: 'gizmo' }
|
49
|
-
@user = User.new(user_attributes_hash)
|
50
|
-
@user.sorcery_adapter.save(raise_on_failure: true)
|
51
|
-
@user.send(authentication_association).create!(provider: provider, uid: 123)
|
52
|
-
@user
|
53
|
-
end
|
54
|
-
|
55
|
-
def sorcery_model_property_set(property, *values)
|
56
|
-
User.class_eval do
|
57
|
-
sorcery_config.send(:"#{property}=", *values)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def update_model(&block)
|
62
|
-
User.class_exec(&block)
|
63
|
-
end
|
64
|
-
|
65
|
-
private
|
66
|
-
|
67
|
-
# reload user class between specs
|
68
|
-
# so it will be possible to test the different submodules in isolation
|
69
|
-
def reload_user_class
|
70
|
-
User && Object.send(:remove_const, 'User')
|
71
|
-
load 'user.rb'
|
72
|
-
|
73
|
-
return unless User.respond_to?(:reset_column_information)
|
74
|
-
|
75
|
-
User.reset_column_information
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|