casino 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data.tar.gz.sig +0 -0
  2. data/Gemfile.lock +11 -5
  3. data/app/assets/images/logo.png +0 -0
  4. data/app/assets/images/logo@2x.png +0 -0
  5. data/app/assets/stylesheets/{casino/index.css.scss → casino.scss} +177 -90
  6. data/app/controllers/casino/sessions_controller.rb +5 -0
  7. data/app/controllers/casino/two_factor_authenticators_controller.rb +15 -0
  8. data/app/views/casino/{sessions → application}/_footer.html.erb +0 -0
  9. data/app/views/casino/application/_messages.html.erb +5 -0
  10. data/app/views/casino/sessions/index.html.erb +13 -2
  11. data/app/views/casino/sessions/logout.html.erb +3 -0
  12. data/app/views/casino/sessions/new.html.erb +1 -5
  13. data/app/views/casino/sessions/validate_otp.html.erb +17 -0
  14. data/app/views/casino/two_factor_authenticators/new.html.erb +32 -0
  15. data/app/views/layouts/application.html.erb +1 -0
  16. data/casino.gemspec +4 -1
  17. data/config/locales/en.yml +23 -0
  18. data/config/routes.rb +3 -0
  19. data/lib/casino/listener.rb +5 -0
  20. data/lib/casino/listener/login_credential_acceptor.rb +5 -0
  21. data/lib/casino/listener/second_factor_authentication_acceptor.rb +26 -0
  22. data/lib/casino/listener/two_factor_authenticator_activator.rb +23 -0
  23. data/lib/casino/listener/two_factor_authenticator_destroyer.rb +16 -0
  24. data/lib/casino/listener/two_factor_authenticator_overview.rb +11 -0
  25. data/lib/casino/listener/two_factor_authenticator_registrator.rb +11 -0
  26. data/lib/casino/version.rb +1 -1
  27. data/lib/generators/casino/install_generator.rb +1 -3
  28. data/lib/generators/casino/templates/casino_and_overrides.scss +12 -0
  29. data/spec/controllers/listener/login_credential_acceptor_spec.rb +18 -0
  30. data/spec/controllers/listener/second_factor_authentication_acceptor_spec.rb +74 -0
  31. data/spec/controllers/listener/two_factor_authenticator_activator_spec.rb +64 -0
  32. data/spec/controllers/listener/two_factor_authenticator_destroyer_spec.rb +40 -0
  33. data/spec/controllers/listener/two_factor_authenticator_overview_spec.rb +16 -0
  34. data/spec/controllers/listener/two_factor_authenticator_registrator_spec.rb +27 -0
  35. data/spec/controllers/sessions_controller_spec.rb +10 -0
  36. data/spec/controllers/two_factor_authenticators_controller_spec.rb +34 -0
  37. metadata +63 -8
  38. metadata.gz.sig +1 -0
  39. data/lib/generators/casino/templates/casino.css +0 -3
  40. data/lib/generators/casino/templates/casino.js +0 -1
Binary file
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- casino (1.0.0)
5
- casino_core (~> 1.2.0)
4
+ casino (1.1.0)
5
+ casino_core (~> 1.3.0)
6
6
  jquery-rails (~> 2.1)
7
7
  rails (~> 3.2.9)
8
8
 
@@ -39,17 +39,21 @@ GEM
39
39
  addressable (2.3.2)
40
40
  arel (3.0.2)
41
41
  builder (3.0.4)
42
- casino_core (1.2.0)
42
+ casino_core (1.3.0)
43
43
  activerecord (~> 3.2.9)
44
44
  addressable (~> 2.3)
45
+ faraday (~> 0.8)
46
+ rotp (~> 1.4)
45
47
  terminal-table (~> 1.4)
46
48
  useragent (~> 0.4)
47
49
  diff-lcs (1.1.3)
48
50
  erubis (2.7.0)
51
+ faraday (0.8.5)
52
+ multipart-post (~> 1.1)
49
53
  hike (1.2.1)
50
54
  i18n (0.6.1)
51
55
  journey (1.0.4)
52
- jquery-rails (2.2.0)
56
+ jquery-rails (2.2.1)
53
57
  railties (>= 3.0, < 5.0)
54
58
  thor (>= 0.14, < 2.0)
55
59
  json (1.7.6)
@@ -57,8 +61,9 @@ GEM
57
61
  i18n (>= 0.4.0)
58
62
  mime-types (~> 1.16)
59
63
  treetop (~> 1.4.8)
60
- mime-types (1.19)
64
+ mime-types (1.20.1)
61
65
  multi_json (1.5.0)
66
+ multipart-post (1.1.5)
62
67
  polyglot (0.3.3)
63
68
  rack (1.4.4)
64
69
  rack-cache (1.2)
@@ -85,6 +90,7 @@ GEM
85
90
  rake (10.0.3)
86
91
  rdoc (3.12)
87
92
  json (~> 1.4)
93
+ rotp (1.4.1)
88
94
  rspec (2.12.0)
89
95
  rspec-core (~> 2.12.0)
90
96
  rspec-expectations (~> 2.12.0)
@@ -1,17 +1,28 @@
1
1
  @import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,600);
2
- @import "normalize.css";
2
+ @import "casino/normalize";
3
3
 
4
+ /// DEFAULT SETTINGS ///
5
+ $buttonColor: #0074ad !default;
6
+ $buttonSecondaryColor: #c2c2c2 !default;
4
7
 
8
+ $logo: "logo.png" !default;
9
+ $logoRetina: "logo@2x.png" !default;
10
+ $logoWidth: 146px !default;
11
+ $logoHeight: 34px !default;
12
+
13
+
14
+
15
+ /// GLOBAL STUFF ///
5
16
  * {
6
17
  box-sizing: border-box;
7
18
  }
8
19
 
9
20
  body {
10
- background: #F6F6F5;
21
+ background: #f6f6f5;
11
22
  color: #222222;
12
23
  font-family: 'Source Sans Pro', sans-serif;
13
- font-weight: 300;
14
24
  font-size: 15px;
25
+ font-weight: 300;
15
26
  }
16
27
 
17
28
  label {
@@ -43,9 +54,9 @@ input[type=password] {
43
54
  }
44
55
 
45
56
  a.button, input[type=submit] {
46
- background: #0074ad;
57
+ background: $buttonColor;
47
58
  border: none;
48
- border: 1px solid #006394;
59
+ border: 1px solid darken($buttonColor, 3%);
49
60
  color: #fff;
50
61
  cursor: pointer;
51
62
  display: inline-block;
@@ -72,13 +83,23 @@ a.button, input[type=submit] {
72
83
  }
73
84
 
74
85
  &:hover {
86
+ background-color: darken($buttonColor, 5%);
75
87
  color: white;
76
- background-color: #005F8F;
77
88
  }
78
89
 
79
90
  &:active {
80
91
  top: 2px;
81
92
  }
93
+
94
+ &.secondary {
95
+ background: $buttonSecondaryColor;
96
+ border: 1px solid darken($buttonSecondaryColor, 3%);
97
+ color: #222;
98
+
99
+ &:hover {
100
+ background-color: darken($buttonSecondaryColor, 5%);
101
+ }
102
+ }
82
103
  }
83
104
 
84
105
  table {
@@ -86,8 +107,8 @@ table {
86
107
  font-size: 90%;
87
108
 
88
109
  th, td {
89
- text-align: left;
90
110
  padding: 8px;
111
+ text-align: left;
91
112
 
92
113
  &:first-child {
93
114
  padding-left: 0px;
@@ -105,112 +126,178 @@ table {
105
126
  }
106
127
  }
107
128
 
129
+
130
+ /// LAYOUT ///
108
131
  .container {
109
132
  width: 100%;
133
+ }
110
134
 
111
- .box {
112
- background: #fff;
113
- border: 1px solid #e6e6e6;
114
- margin: auto;
115
- margin-top: 10%;
116
- overflow: auto;
117
- padding: 20px;
118
- width: 560px;
135
+ .box {
136
+ background: #fff;
137
+ border: 1px solid #e6e6e6;
138
+ margin: auto;
139
+ margin-top: 10%;
140
+ overflow: auto;
141
+ padding: 20px;
142
+ width: 560px;
143
+ }
119
144
 
120
- .info {
121
- width: 100%;
122
- height: auto;
123
- background: image-url("logo.png") no-repeat right top;
124
- }
145
+ .logo {
146
+ background-image: image-url($logo);
147
+ background-repeat: no-repeat;
148
+
149
+ img {
150
+ visibility: hidden;
125
151
  }
126
152
 
153
+ @media (min--moz-device-pixel-ratio: 1.3),
154
+ (-o-min-device-pixel-ratio: 2.6/2),
155
+ (-webkit-min-device-pixel-ratio: 1.3),
156
+ (min-device-pixel-ratio: 1.3),
157
+ (min-resolution: 1.3dppx) {
158
+ background-image: image-url($logoRetina);
159
+ background-size: $logoWidth $logoHeight;
160
+ }
161
+ }
127
162
 
128
- .login {
129
- > div {
130
- height: 241px;
131
- }
163
+ footer {
164
+ color: #949494;
165
+ font-size: 80%;
166
+ font-weight: 200;
167
+ padding-top: 10px;
168
+ margin-bottom: 50px;
169
+ text-align: center;
170
+ }
132
171
 
133
- #flash_error {
134
- // position: absolute;
135
- margin-top: -10px;
136
- background-color: #ffebeb;
137
- border: 1px solid #FFD6D6;
138
- padding: 0 5px;
139
- width: 100%;
140
- height: 28px;
141
- line-height: 28px;
142
- font-weight: 400;
143
- }
172
+ #flash_notice,
173
+ #flash_error {
174
+ background-color: #FBECC6;
175
+ border: 1px solid #F8DFA0;
176
+ font-weight: 600;
177
+ height: 28px;
178
+ line-height: 28px;
179
+ margin-top: -10px;
180
+ padding: 0 5px;
181
+ width: 100%;
182
+ }
144
183
 
145
- .logo {
146
- background: image-url("logo.png") no-repeat 15px 50%;
147
- float: left;
148
- padding: 0 15px;
149
- width: 45%;
184
+ #flash_error {
185
+ background-color: #ffebeb;
186
+ border: 1px solid #FFD6D6;
187
+ }
150
188
 
151
- img {
152
- visibility: hidden;
153
- }
154
- }
189
+ /// LOGIN ///
190
+ .login {
191
+ > div {
192
+ height: 241px;
193
+ }
155
194
 
156
- .form {
157
- border-left: 1px solid #eee;
158
- float: left;
159
- padding: 15px;
160
- width: 55%;
195
+ .logo {
196
+ background-position: 15px 50%;
197
+ display: inline-block;
198
+ float: left;
199
+ padding: 0 15px;
200
+ width: 45%;
201
+
202
+ img {
203
+ visibility: hidden;
161
204
  }
162
205
  }
163
206
 
164
- .sessions {
165
- width: 800px;
207
+ .form {
208
+ border-left: 1px solid #eee;
209
+ float: left;
210
+ padding: 15px;
211
+ width: 55%;
212
+ }
213
+ }
166
214
 
167
- a.button {
168
- margin-top: 0;
169
- }
170
215
 
171
- h3 {
172
- margin: 40px 0 5px;
173
- }
216
+ /// SESSIONS ///
217
+ .sessions, .logout {
218
+ width: 800px;
174
219
 
175
- table.tickets {
176
- margin-bottom: 10px;
177
- }
220
+ > div {
221
+ height: 190px;
222
+ }
223
+
224
+ .info {
225
+ float: left;
226
+ width: 60%;
227
+ }
228
+
229
+ .logo {
230
+ background-position: right 1.8em;
231
+ float: left;
232
+ width: 40%;
233
+ }
234
+
235
+
236
+ a.button {
237
+ margin-top: 0;
238
+ }
239
+
240
+ h3 {
241
+ margin: 40px 0 5px;
242
+ }
243
+
244
+ table.tickets {
245
+ margin-bottom: 10px;
178
246
  }
179
247
  }
180
248
 
181
- footer {
182
- color: #949494;
183
- text-align: center;
184
- padding-top: 10px;
185
- font-size: 80%;
186
- font-weight: 200;
249
+ /// LOGOUT ///
250
+ .logout {
251
+ width: 560px;
187
252
  }
188
253
 
254
+ /// TWO-FACTOR ///
255
+ .twofactor {
256
+ margin-top: 5%;
257
+
258
+ #qr-code {
259
+ width: 100%;
260
+ text-align: center;
261
+ }
262
+ }
263
+
264
+
265
+ /// RESPONSIVE ///
189
266
  @media only screen and (max-width: 600px) {
190
267
  .container {
191
268
  padding-top: 0;
269
+ }
192
270
 
193
- .box {
271
+ .box {
272
+ width: 100%;
273
+ }
274
+
275
+ .sessions, .logout {
276
+ .info {
277
+ margin-top: 40px;
194
278
  width: 100%;
195
279
  }
196
280
 
197
- .login {
198
- > div {
199
- height: auto;
200
- }
281
+ .logo {
282
+ background-position: 0 0;
283
+ float: none;
284
+ height: 200px;
285
+ padding: 0;
286
+ width: 100%;
287
+ }
288
+ }
201
289
 
202
- .logo {
203
- float: none;
204
- width: 100%;
205
- padding: 0px 15px;
206
- background-position: 15px 0;
207
- }
290
+ .login, .logout {
291
+ > div {
292
+ height: auto;
293
+ }
294
+ }
208
295
 
209
- .form {
210
- border-left: none;
211
- width: 100%;
212
- padding-bottom: 0;
213
- }
296
+ .login {
297
+ .form {
298
+ border-left: none;
299
+ padding-bottom: 0;
300
+ width: 100%;
214
301
  }
215
302
  }
216
303
  }
@@ -219,8 +306,8 @@ footer {
219
306
  @media only screen and (max-width: 800px) {
220
307
  .container {
221
308
  .sessions {
222
- width: 100%;
223
309
  margin-top: 10px;
310
+ width: 100%;
224
311
  }
225
312
 
226
313
  table, thead, tbody, th, td, tr {
@@ -233,8 +320,8 @@ footer {
233
320
 
234
321
  tr {
235
322
  border: none;
236
- margin-bottom: 10px;
237
323
  border-bottom: 1px solid #e2e2e2;
324
+ margin-bottom: 10px;
238
325
 
239
326
  &:last-child {
240
327
  border-bottom: none;
@@ -248,8 +335,8 @@ footer {
248
335
 
249
336
  td {
250
337
  border: none;
251
- position: relative;
252
338
  padding-left: 50%;
339
+ position: relative;
253
340
 
254
341
  &:first-child {
255
342
  padding-left: 50%;
@@ -261,14 +348,14 @@ footer {
261
348
  }
262
349
 
263
350
  td:before {
264
- position: absolute;
265
- top: 6px;
351
+ content: attr(data-label);
352
+ font-weight: bold;
266
353
  left: 0;
267
- width: 45%;
268
354
  padding-right: 10px;
355
+ position: absolute;
356
+ top: 6px;
269
357
  white-space: nowrap;
270
- font-weight: bold;
271
- content: attr(data-label);
358
+ width: 45%;
272
359
  }
273
360
  }
274
361
  }
@@ -2,6 +2,7 @@ class CASino::SessionsController < CASino::ApplicationController
2
2
  include CASino::SessionsHelper
3
3
 
4
4
  def index
5
+ processor(:TwoFactorAuthenticatorOverview).process(cookies, request.user_agent)
5
6
  processor(:SessionOverview).process(cookies, request.user_agent)
6
7
  end
7
8
 
@@ -20,4 +21,8 @@ class CASino::SessionsController < CASino::ApplicationController
20
21
  def logout
21
22
  processor(:Logout).process(params, cookies, request.user_agent)
22
23
  end
24
+
25
+ def validate_otp
26
+ processor(:SecondFactorAuthenticationAcceptor).process(params, request.user_agent)
27
+ end
23
28
  end