rodauth 0.10.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +146 -0
  3. data/README.rdoc +644 -220
  4. data/Rakefile +99 -11
  5. data/doc/account_expiration.rdoc +55 -0
  6. data/doc/base.rdoc +104 -0
  7. data/doc/change_login.rdoc +29 -0
  8. data/doc/change_password.rdoc +26 -0
  9. data/doc/close_account.rdoc +31 -0
  10. data/doc/confirm_password.rdoc +22 -0
  11. data/doc/create_account.rdoc +34 -0
  12. data/doc/disallow_password_reuse.rdoc +37 -0
  13. data/doc/email_base.rdoc +19 -0
  14. data/doc/jwt.rdoc +35 -0
  15. data/doc/lockout.rdoc +83 -0
  16. data/doc/login.rdoc +27 -0
  17. data/doc/login_password_requirements_base.rdoc +50 -0
  18. data/doc/logout.rdoc +21 -0
  19. data/doc/otp.rdoc +100 -0
  20. data/doc/password_complexity.rdoc +50 -0
  21. data/doc/password_expiration.rdoc +52 -0
  22. data/doc/password_grace_period.rdoc +10 -0
  23. data/doc/recovery_codes.rdoc +60 -0
  24. data/doc/release_notes/1.0.0.txt +443 -0
  25. data/doc/remember.rdoc +82 -0
  26. data/doc/reset_password.rdoc +70 -0
  27. data/doc/session_expiration.rdoc +27 -0
  28. data/doc/single_session.rdoc +43 -0
  29. data/doc/sms_codes.rdoc +119 -0
  30. data/doc/two_factor_base.rdoc +27 -0
  31. data/doc/verify_account.rdoc +70 -0
  32. data/doc/verify_account_grace_period.rdoc +15 -0
  33. data/doc/verify_change_login.rdoc +9 -0
  34. data/lib/roda/plugins/rodauth.rb +3 -262
  35. data/lib/rodauth.rb +260 -0
  36. data/lib/rodauth/features/account_expiration.rb +108 -0
  37. data/lib/rodauth/features/base.rb +479 -0
  38. data/lib/rodauth/features/change_login.rb +77 -0
  39. data/lib/rodauth/features/change_password.rb +66 -0
  40. data/lib/rodauth/features/close_account.rb +82 -0
  41. data/lib/rodauth/features/confirm_password.rb +51 -0
  42. data/lib/rodauth/features/create_account.rb +128 -0
  43. data/lib/rodauth/features/disallow_password_reuse.rb +82 -0
  44. data/lib/rodauth/features/email_base.rb +63 -0
  45. data/lib/rodauth/features/jwt.rb +151 -0
  46. data/lib/rodauth/features/lockout.rb +262 -0
  47. data/lib/rodauth/features/login.rb +61 -0
  48. data/lib/rodauth/features/login_password_requirements_base.rb +123 -0
  49. data/lib/rodauth/features/logout.rb +37 -0
  50. data/lib/rodauth/features/otp.rb +338 -0
  51. data/lib/rodauth/features/password_complexity.rb +89 -0
  52. data/lib/rodauth/features/password_expiration.rb +111 -0
  53. data/lib/rodauth/features/password_grace_period.rb +46 -0
  54. data/lib/rodauth/features/recovery_codes.rb +240 -0
  55. data/lib/rodauth/features/remember.rb +200 -0
  56. data/lib/rodauth/features/reset_password.rb +207 -0
  57. data/lib/rodauth/features/session_expiration.rb +55 -0
  58. data/lib/rodauth/features/single_session.rb +87 -0
  59. data/lib/rodauth/features/sms_codes.rb +498 -0
  60. data/lib/rodauth/features/two_factor_base.rb +135 -0
  61. data/lib/rodauth/features/verify_account.rb +232 -0
  62. data/lib/rodauth/features/verify_account_grace_period.rb +76 -0
  63. data/lib/rodauth/features/verify_change_login.rb +20 -0
  64. data/lib/rodauth/migrations.rb +130 -0
  65. data/lib/rodauth/version.rb +9 -0
  66. data/spec/account_expiration_spec.rb +90 -0
  67. data/spec/all.rb +1 -0
  68. data/spec/change_login_spec.rb +149 -0
  69. data/spec/change_password_spec.rb +177 -0
  70. data/spec/close_account_spec.rb +162 -0
  71. data/spec/confirm_password_spec.rb +70 -0
  72. data/spec/create_account_spec.rb +127 -0
  73. data/spec/disallow_password_reuse_spec.rb +84 -0
  74. data/spec/lockout_spec.rb +228 -0
  75. data/spec/login_spec.rb +188 -0
  76. data/spec/migrate/001_tables.rb +103 -16
  77. data/spec/migrate/002_account_password_hash_column.rb +11 -0
  78. data/spec/migrate_password/001_tables.rb +60 -42
  79. data/spec/migrate_travis/001_tables.rb +116 -0
  80. data/spec/password_complexity_spec.rb +108 -0
  81. data/spec/password_expiration_spec.rb +243 -0
  82. data/spec/password_grace_period_spec.rb +93 -0
  83. data/spec/remember_spec.rb +424 -0
  84. data/spec/reset_password_spec.rb +185 -0
  85. data/spec/rodauth_spec.rb +57 -980
  86. data/spec/session_expiration_spec.rb +58 -0
  87. data/spec/single_session_spec.rb +107 -0
  88. data/spec/spec_helper.rb +202 -0
  89. data/spec/two_factor_spec.rb +1310 -0
  90. data/spec/verify_account_grace_period_spec.rb +135 -0
  91. data/spec/verify_account_spec.rb +142 -0
  92. data/spec/verify_change_login_spec.rb +46 -0
  93. data/spec/views/login.str +2 -2
  94. data/templates/add-recovery-codes.str +2 -0
  95. data/templates/button.str +5 -0
  96. data/templates/change-login.str +5 -18
  97. data/templates/change-password.str +6 -14
  98. data/templates/close-account.str +3 -6
  99. data/templates/confirm-password.str +4 -14
  100. data/templates/create-account.str +6 -30
  101. data/templates/login-confirm-field.str +6 -0
  102. data/templates/login-field.str +6 -0
  103. data/templates/login.str +5 -19
  104. data/templates/logout.str +2 -6
  105. data/templates/otp-auth-code-field.str +6 -0
  106. data/templates/otp-auth.str +8 -0
  107. data/templates/otp-disable.str +6 -0
  108. data/templates/otp-setup.str +21 -0
  109. data/templates/password-confirm-field.str +6 -0
  110. data/templates/password-field.str +6 -0
  111. data/templates/recovery-auth.str +12 -0
  112. data/templates/recovery-codes.str +6 -0
  113. data/templates/remember.str +8 -12
  114. data/templates/reset-password-request.str +2 -2
  115. data/templates/reset-password.str +4 -18
  116. data/templates/sms-auth.str +6 -0
  117. data/templates/sms-code-field.str +6 -0
  118. data/templates/sms-confirm.str +7 -0
  119. data/templates/sms-disable.str +7 -0
  120. data/templates/sms-request.str +5 -0
  121. data/templates/sms-setup.str +12 -0
  122. data/templates/unlock-account-request.str +3 -7
  123. data/templates/unlock-account.str +4 -7
  124. data/templates/verify-account-resend.str +2 -2
  125. data/templates/verify-account.str +2 -6
  126. metadata +191 -29
  127. data/lib/roda/plugins/rodauth/base.rb +0 -428
  128. data/lib/roda/plugins/rodauth/change_login.rb +0 -48
  129. data/lib/roda/plugins/rodauth/change_password.rb +0 -42
  130. data/lib/roda/plugins/rodauth/close_account.rb +0 -42
  131. data/lib/roda/plugins/rodauth/create_account.rb +0 -92
  132. data/lib/roda/plugins/rodauth/lockout.rb +0 -292
  133. data/lib/roda/plugins/rodauth/login.rb +0 -81
  134. data/lib/roda/plugins/rodauth/logout.rb +0 -36
  135. data/lib/roda/plugins/rodauth/remember.rb +0 -226
  136. data/lib/roda/plugins/rodauth/reset_password.rb +0 -205
  137. data/lib/roda/plugins/rodauth/verify_account.rb +0 -228
@@ -0,0 +1,93 @@
1
+ require File.expand_path("spec_helper", File.dirname(__FILE__))
2
+
3
+ describe 'Rodauth password grace period feature' do
4
+ it "should not ask for password again if password was recently entered" do
5
+ grace = 300
6
+ rodauth do
7
+ enable :login, :change_login, :password_grace_period
8
+ password_grace_period{grace}
9
+ require_login_confirmation? false
10
+ end
11
+ roda do |r|
12
+ r.rodauth
13
+ r.root{view :content=>rodauth.logged_in? ? "Logged In" : "Not Logged"}
14
+ end
15
+
16
+ login
17
+ page.body.must_include "Logged In"
18
+
19
+ visit '/change-login'
20
+ fill_in 'Login', :with=>'foo2@example.com'
21
+ click_button 'Change Login'
22
+ page.find('#notice_flash').text.must_equal "Your login has been changed"
23
+
24
+ grace = -1
25
+ visit '/change-login'
26
+ fill_in 'Login', :with=>'foo3@example.com'
27
+ fill_in 'Password', :with=>'0123456789'
28
+ click_button 'Change Login'
29
+ page.find('#notice_flash').text.must_equal "Your login has been changed"
30
+
31
+ grace = 300
32
+ visit '/change-login'
33
+ grace = -1
34
+ fill_in 'Login', :with=>'foo4@example.com'
35
+ click_button 'Change Login'
36
+ page.find('#error_flash').text.must_equal "There was an error changing your login"
37
+ page.html.must_include("invalid password")
38
+
39
+ fill_in 'Password', :with=>'0123456789'
40
+ click_button 'Change Login'
41
+ page.find('#notice_flash').text.must_equal "Your login has been changed"
42
+ end
43
+
44
+ it "should not ask for password again directly after creating an account" do
45
+ rodauth do
46
+ enable :create_account, :change_login, :password_grace_period
47
+ require_login_confirmation? false
48
+ end
49
+ roda do |r|
50
+ r.rodauth
51
+ r.root{view :content=>rodauth.logged_in? ? "Logged In" : "Not Logged"}
52
+ end
53
+
54
+ visit '/create-account'
55
+ fill_in 'Login', :with=>'foo2@example.com'
56
+ fill_in 'Password', :with=>'apple2'
57
+ fill_in 'Confirm Password', :with=>'apple2'
58
+ click_button 'Create Account'
59
+
60
+ visit '/change-login'
61
+ fill_in 'Login', :with=>'foo3@example.com'
62
+ click_button 'Change Login'
63
+ page.find('#notice_flash').text.must_equal "Your login has been changed"
64
+ end
65
+
66
+ it "should not ask for password again directly after resetting a password" do
67
+ rodauth do
68
+ enable :login, :reset_password, :change_login, :password_grace_period
69
+ require_login_confirmation? false
70
+ reset_password_autologin? true
71
+ end
72
+ roda do |r|
73
+ r.rodauth
74
+ r.root{view :content=>rodauth.logged_in? ? "Logged In" : "Not Logged"}
75
+ end
76
+
77
+ login(:pass=>'01234567')
78
+ click_button 'Request Password Reset'
79
+ link = email_link(/(\/reset-password\?key=.+)$/)
80
+ visit link
81
+ fill_in 'Password', :with=>'0123456'
82
+ fill_in 'Confirm Password', :with=>'0123456'
83
+ click_button 'Reset Password'
84
+ page.find('#notice_flash').text.must_equal "Your password has been reset"
85
+ page.current_path.must_equal '/'
86
+
87
+ visit '/change-login'
88
+ fill_in 'Login', :with=>'foo2@example.com'
89
+ click_button 'Change Login'
90
+ page.find('#notice_flash').text.must_equal "Your login has been changed"
91
+ end
92
+ end
93
+
@@ -0,0 +1,424 @@
1
+ require File.expand_path("spec_helper", File.dirname(__FILE__))
2
+
3
+ describe 'Rodauth remember feature' do
4
+ it "should support login via remember token" do
5
+ rodauth do
6
+ enable :login, :remember
7
+ end
8
+ roda do |r|
9
+ r.rodauth
10
+ r.get 'load' do
11
+ rodauth.load_memory
12
+ r.redirect '/'
13
+ end
14
+ r.root do
15
+ if rodauth.logged_in?
16
+ if rodauth.logged_in_via_remember_key?
17
+ view :content=>"Logged In via Remember"
18
+ else
19
+ view :content=>"Logged In Normally"
20
+ end
21
+ else
22
+ view :content=>"Not Logged In"
23
+ end
24
+ end
25
+ end
26
+
27
+ login
28
+ page.body.must_include 'Logged In Normally'
29
+
30
+ visit '/load'
31
+ page.body.must_include 'Logged In Normally'
32
+
33
+ visit '/remember'
34
+ click_button 'Change Remember Setting'
35
+ page.find('#error_flash').text.must_equal "There was an error updating your remember setting"
36
+
37
+ choose 'Remember Me'
38
+ click_button 'Change Remember Setting'
39
+ page.find('#notice_flash').text.must_equal "Your remember setting has been updated"
40
+ page.body.must_include 'Logged In Normally'
41
+
42
+ remove_cookie('rack.session')
43
+ visit '/'
44
+ page.body.must_include 'Not Logged In'
45
+
46
+ visit '/load'
47
+ page.body.must_include 'Logged In via Remember'
48
+
49
+ key = get_cookie('_remember')
50
+ visit '/remember'
51
+ choose 'Forget Me'
52
+ click_button 'Change Remember Setting'
53
+ page.body.must_include 'Logged In via Remember'
54
+
55
+ remove_cookie('rack.session')
56
+ visit '/'
57
+ page.body.must_include 'Not Logged In'
58
+
59
+ visit '/load'
60
+ page.body.must_include 'Not Logged In'
61
+
62
+ set_cookie('_remember', key)
63
+ visit '/load'
64
+ page.body.must_include 'Logged In via Remember'
65
+
66
+ visit '/remember'
67
+ choose 'Disable Remember Me'
68
+ click_button 'Change Remember Setting'
69
+ page.body.must_include 'Logged In via Remember'
70
+
71
+ remove_cookie('rack.session')
72
+ visit '/'
73
+ page.body.must_include 'Not Logged In'
74
+
75
+ set_cookie('_remember', key)
76
+ visit '/load'
77
+ page.body.must_include 'Not Logged In'
78
+ end
79
+
80
+ it "should forget remember token when explicitly logging out" do
81
+ rodauth do
82
+ enable :login, :logout, :remember
83
+ end
84
+ roda do |r|
85
+ r.rodauth
86
+ r.get 'load' do
87
+ rodauth.load_memory
88
+ r.redirect '/'
89
+ end
90
+ r.root{rodauth.logged_in? ? "Logged In#{session[:remembered]}" : "Not Logged In"}
91
+ end
92
+
93
+ login
94
+ page.body.must_equal 'Logged In'
95
+
96
+ visit '/remember'
97
+ choose 'Remember Me'
98
+ click_button 'Change Remember Setting'
99
+ page.body.must_equal 'Logged In'
100
+
101
+ logout
102
+
103
+ visit '/'
104
+ page.body.must_equal 'Not Logged In'
105
+
106
+ visit '/load'
107
+ page.body.must_equal 'Not Logged In'
108
+ end
109
+
110
+ it "should remove cookie if cookie is no longer valid" do
111
+ rodauth do
112
+ enable :login, :remember
113
+ skip_status_checks? false
114
+ end
115
+ roda do |r|
116
+ r.rodauth
117
+ r.get 'load' do
118
+ rodauth.load_memory
119
+ r.redirect '/'
120
+ end
121
+ r.root do
122
+ if rodauth.logged_in?
123
+ if rodauth.logged_in_via_remember_key?
124
+ view :content=>"Logged In via Remember"
125
+ else
126
+ view :content=>"Logged In Normally"
127
+ end
128
+ else
129
+ view :content=>"Not Logged In"
130
+ end
131
+ end
132
+ end
133
+
134
+ login
135
+ visit '/remember'
136
+ choose 'Remember Me'
137
+ click_button 'Change Remember Setting'
138
+ page.body.must_include 'Logged In Normally'
139
+
140
+ cookie = get_cookie('_remember')
141
+ remove_cookie('rack.session')
142
+
143
+ rk = DB[:account_remember_keys].first
144
+ DB[:account_remember_keys].update(:key=>rk[:key][0...-1])
145
+ visit '/load'
146
+ page.body.must_include 'Not Logged In'
147
+ get_cookie('_remember').must_equal ""
148
+
149
+ DB[:account_remember_keys].delete
150
+ set_cookie('_remember', cookie)
151
+ visit '/load'
152
+ page.body.must_include 'Not Logged In'
153
+ get_cookie('_remember').must_equal ""
154
+
155
+ DB[:account_remember_keys].insert(rk)
156
+ DB[:accounts].update(:status_id=>3)
157
+ set_cookie('_remember', cookie)
158
+ visit '/load'
159
+ page.body.must_include 'Not Logged In'
160
+ get_cookie('_remember').must_equal ""
161
+ DB[:account_remember_keys].must_be :empty?
162
+ end
163
+
164
+ it "should support clearing remembered flag" do
165
+ rodauth do
166
+ enable :login, :remember
167
+ end
168
+ roda do |r|
169
+ r.rodauth
170
+ r.get 'load' do
171
+ rodauth.load_memory
172
+ r.redirect '/'
173
+ end
174
+ r.root do
175
+ if rodauth.logged_in?
176
+ if rodauth.logged_in_via_remember_key?
177
+ view :content=>"Logged In via Remember"
178
+ else
179
+ view :content=>"Logged In Normally"
180
+ end
181
+ else
182
+ view :content=>"Not Logged In"
183
+ end
184
+ end
185
+ end
186
+
187
+ login
188
+ page.body.must_include 'Logged In Normally'
189
+
190
+ visit '/remember'
191
+ choose 'Remember Me'
192
+ click_button 'Change Remember Setting'
193
+ page.body.must_include 'Logged In Normally'
194
+
195
+ remove_cookie('rack.session')
196
+ visit '/'
197
+ page.body.must_include 'Not Logged In'
198
+
199
+ visit '/load'
200
+ page.body.must_include 'Logged In via Remember'
201
+
202
+ visit '/confirm-password'
203
+ fill_in 'Password', :with=>'012345678'
204
+ click_button 'Confirm Password'
205
+ page.find('#error_flash').text.must_equal "There was an error confirming your password"
206
+ page.html.must_include("invalid password")
207
+
208
+ fill_in 'Password', :with=>'0123456789'
209
+ click_button 'Confirm Password'
210
+ page.find('#notice_flash').text.must_equal "Your password has been confirmed"
211
+ page.body.must_include 'Logged In Normally'
212
+ end
213
+
214
+ it "should support extending remember token" do
215
+ rodauth do
216
+ enable :login, :remember
217
+ extend_remember_deadline? true
218
+ remember_period :days=>30
219
+ end
220
+ roda do |r|
221
+ r.rodauth
222
+ r.get 'load' do
223
+ rodauth.load_memory
224
+ r.redirect '/'
225
+ end
226
+ r.root{rodauth.logged_in? ? "Logged In#{session[:remembered]}" : "Not Logged In"}
227
+ end
228
+
229
+ login
230
+
231
+ visit '/remember'
232
+ choose 'Remember Me'
233
+ click_button 'Change Remember Setting'
234
+ deadline = DB[:account_remember_keys].get(:deadline)
235
+ deadline = Time.parse(deadline) if deadline.is_a?(String)
236
+ deadline.must_be(:<, Time.now + 15*86400)
237
+
238
+ remove_cookie('rack.session')
239
+ visit '/'
240
+ page.body.must_equal 'Not Logged In'
241
+
242
+ old_expiration = page.driver.browser.rack_mock_session.cookie_jar.instance_variable_get(:@cookies).first.expires
243
+ visit '/load'
244
+ page.body.must_equal 'Logged Intrue'
245
+ new_expiration = page.driver.browser.rack_mock_session.cookie_jar.instance_variable_get(:@cookies).first.expires
246
+ new_expiration.must_be :>=, old_expiration
247
+ deadline = DB[:account_remember_keys].get(:deadline)
248
+ deadline = Time.parse(deadline) if deadline.is_a?(String)
249
+ deadline.must_be(:>, Time.now + 29*86400)
250
+ end
251
+
252
+ it "should clear remember token when closing account" do
253
+ rodauth do
254
+ enable :login, :remember, :close_account
255
+ end
256
+ roda do |r|
257
+ r.rodauth
258
+ rodauth.load_memory
259
+ r.root{rodauth.logged_in? ? "Logged In#{session[:remembered]}" : "Not Logged In"}
260
+ end
261
+
262
+ login
263
+
264
+ visit '/remember'
265
+ choose 'Remember Me'
266
+ click_button 'Change Remember Setting'
267
+ DB[:account_remember_keys].count.must_equal 1
268
+
269
+ visit '/close-account'
270
+ fill_in 'Password', :with=>'0123456789'
271
+ click_button 'Close Account'
272
+ DB[:account_remember_keys].count.must_equal 0
273
+ end
274
+
275
+ it "should not use remember token if the account is not open" do
276
+ rodauth do
277
+ enable :login, :remember
278
+ skip_status_checks? false
279
+ end
280
+ roda do |r|
281
+ r.rodauth
282
+ r.get 'load' do
283
+ rodauth.load_memory
284
+ r.redirect '/'
285
+ end
286
+ r.root do
287
+ if rodauth.logged_in?
288
+ if rodauth.logged_in_via_remember_key?
289
+ "Logged In via Remember"
290
+ else
291
+ "Logged In Normally"
292
+ end
293
+ else
294
+ "Not Logged In"
295
+ end
296
+ end
297
+ end
298
+
299
+ login
300
+ page.body.must_equal 'Logged In Normally'
301
+
302
+ visit '/load'
303
+ page.body.must_equal 'Logged In Normally'
304
+
305
+ visit '/remember'
306
+ choose 'Remember Me'
307
+ click_button 'Change Remember Setting'
308
+ page.body.must_equal 'Logged In Normally'
309
+
310
+ remove_cookie('rack.session')
311
+ visit '/'
312
+ page.body.must_equal 'Not Logged In'
313
+
314
+ DB[:accounts].update(:status_id=>3)
315
+
316
+ visit '/load'
317
+ page.body.must_equal 'Not Logged In'
318
+ end
319
+
320
+ it "should handle uniqueness errors raised when inserting remember token" do
321
+ rodauth do
322
+ enable :login, :remember
323
+ end
324
+ roda do |r|
325
+ def rodauth.raised_uniqueness_violation(*) super; true; end
326
+ r.rodauth
327
+ r.get 'load' do
328
+ rodauth.load_memory
329
+ r.redirect '/'
330
+ end
331
+ r.root do
332
+ if rodauth.logged_in?
333
+ if rodauth.logged_in_via_remember_key?
334
+ "Logged In via Remember"
335
+ else
336
+ "Logged In Normally"
337
+ end
338
+ else
339
+ "Not Logged In"
340
+ end
341
+ end
342
+ end
343
+
344
+ login
345
+
346
+ visit '/remember'
347
+ choose 'Remember Me'
348
+ click_button 'Change Remember Setting'
349
+ page.body.must_equal 'Logged In Normally'
350
+ end
351
+
352
+ it "should support login via remember token via jwt" do
353
+ rodauth do
354
+ enable :login, :remember
355
+ end
356
+ roda(:jwt) do |r|
357
+ r.rodauth
358
+
359
+ r.post 'load' do
360
+ rodauth.load_memory
361
+ [4]
362
+ end
363
+
364
+ if rodauth.logged_in?
365
+ if rodauth.logged_in_via_remember_key?
366
+ [1]
367
+ else
368
+ [2]
369
+ end
370
+ else
371
+ [3]
372
+ end
373
+ end
374
+
375
+ json_request.must_equal [200, [3]]
376
+ json_login
377
+ json_request.must_equal [200, [2]]
378
+
379
+ json_request('/load').must_equal [200, [4]]
380
+ json_request.must_equal [200, [2]]
381
+
382
+ res = json_request('/remember', :remember=>'remember')
383
+ res.must_equal [200, {'success'=>"Your remember setting has been updated"}]
384
+
385
+ @authorization = nil
386
+ json_request.must_equal [200, [3]]
387
+ json_request('/load').must_equal [200, [4]]
388
+ json_request.must_equal [200, [1]]
389
+
390
+ cookie = @cookie
391
+ res = json_request('/remember', :remember=>'forget')
392
+ res.must_equal [200, {'success'=>"Your remember setting has been updated"}]
393
+ json_request.must_equal [200, [1]]
394
+
395
+ @cookie = nil
396
+ @authorization = nil
397
+ json_request.must_equal [200, [3]]
398
+
399
+ json_request('/load').must_equal [200, [4]]
400
+ json_request.must_equal [200, [3]]
401
+
402
+ @cookie = cookie
403
+ json_request('/load').must_equal [200, [4]]
404
+ json_request.must_equal [200, [1]]
405
+
406
+ res = json_request('/confirm-password', :password=>'123456')
407
+ res.must_equal [400, {'error'=>"There was an error confirming your password", "field-error"=>["password", "invalid password"]}]
408
+
409
+ res = json_request('/confirm-password', :password=>'0123456789')
410
+ res.must_equal [200, {'success'=>"Your password has been confirmed"}]
411
+ json_request.must_equal [200, [2]]
412
+
413
+ res = json_request('/remember', :remember=>'disable')
414
+ res.must_equal [200, {'success'=>"Your remember setting has been updated"}]
415
+
416
+ @authorization = nil
417
+ @cookie = nil
418
+ json_request.must_equal [200, [3]]
419
+
420
+ @cookie = cookie
421
+ json_request('/load').must_equal [200, [4]]
422
+ json_request.must_equal [200, [3]]
423
+ end
424
+ end