rodauth 1.17.0 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1798ddc466406349db5af1aade5b74cc46996c13c2fa67deaba0b4dd868f5a8
4
- data.tar.gz: fc4232e2eefd30d947285667355fe67bfcd3cd8bb8271d5137f812da525b7ff2
3
+ metadata.gz: 0005c04210782f2fa730e3078b9c757930c7a9980cd9cb7228da66277175bc7a
4
+ data.tar.gz: c036f628ddf2479c303cb53b32c67f3b55b63d41037168ff7444c3f32fc4a3dd
5
5
  SHA512:
6
- metadata.gz: cb68af1641b0c62f21ac2c0dca6fff2384e4fd45e6110e0bf4ef7ebf7d037475aa0a6f2caa84218303c49be23fc0d05a0735e484374bc9bb4b229967cd9574b2
7
- data.tar.gz: e2d63f243e0ebfded4b2145cec4b2ae6c9f27980e4a41c9de2b2726aeb22fa4e488a1ae68defb33adfe724666aa6d41649694d06aec06b7de8fd6abe85b57304
6
+ metadata.gz: 13da13bd1f74c5ceb9cc3d00983e832039d1081c532a49a0901a56d9f1242b2d04848d27f2672c6187a7f51343a94fc079d29d3363464562171a120c26b76325
7
+ data.tar.gz: fc56e0f75f4d095d1b326301e282eac64bbbfb8a52ccbce78aacc4dcb76288db1edb4d009d3ed234865449afd48cbba43e022b9b2d3f52ba838df703a3b62d38
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ === 1.18.0 (2018-07-18)
2
+
3
+ * Add confirm_password_redirect_session_key configuration method to confirm_password feature (jeremyevans)
4
+
5
+ * Work with Roda sessions plugin, using string keys for session information if that is used (jeremyevans)
6
+
7
+ * Add flash_error_key and flash_notice_key configuration for setting keys used in flash (jeremyevans)
8
+
1
9
  === 1.17.0 (2018-06-11)
2
10
 
3
11
  * Support Roda route_csrf plugin for request-specific CSRF tokens (jeremyevans)
@@ -41,6 +41,8 @@ cache_templates :: Whether to cache templates. True by default. It may be worth
41
41
  switching this to false in development if you are using your
42
42
  own templates instead of the templates provided by Rodauth.
43
43
  default_redirect :: Where to redirect after most successful actions.
44
+ flash_error_key :: The flash key to use for error messages (default: +:error+).
45
+ flash_notice_key :: The flash key to use for notice messages (default: +:notice+).
44
46
  invalid_field_error_status :: The response status to use for invalid field
45
47
  value errors, 422 by default.
46
48
  invalid_key_error_status :: The response status to use for invalid key codes,
@@ -10,7 +10,8 @@ confirm_password_additional_form_tags :: HTML fragment containing additional for
10
10
  confirm_password_button :: The text to use for the confirm password button.
11
11
  confirm_password_error_flash :: The flash error to show if password confirmation is unsuccessful.
12
12
  confirm_password_notice_flash :: The flash notice to show after password confirmed successful.
13
- confirm_password_redirect :: Where to redirect after successful password confirmation. By default, uses <tt>session[:confirm_password_redirect]</tt> if set, allowing an easy way to redirect back to the page requesting password confirmation.
13
+ confirm_password_redirect :: Where to redirect after successful password confirmation. By default, uses <tt>session[confirm_password_redirect_session_key]</tt> if set, allowing an easy way to redirect back to the page requesting password confirmation.
14
+ confirm_password_redirect_session_key :: The session key used to check for the confirm_password_redirect.
14
15
  confirm_password_route :: The route to the confirm password form. Defaults to
15
16
  +confirm-password+.
16
17
 
@@ -0,0 +1,26 @@
1
+ = New Features
2
+
3
+ * flash_error_key and flash_notice_key configuration methods have
4
+ been added for setting the keys used in the flash hash.
5
+
6
+ * A confirm_password_redirect_session_key configuration method was
7
+ added for configuring the session key used for storing the
8
+ confirm password redirect.
9
+
10
+ = Other Improvements
11
+
12
+ * Support for the new Roda sessions plugin has been added. Rodauth
13
+ now recognizes the :sessions_convert_symbols Roda application option
14
+ and will default to using string keys instead of symbol keys for
15
+ session and flash values if the application option is set.
16
+
17
+ = Backwards Compatibility
18
+
19
+ * If the :sessions_convert_symbols Roda application option is used,
20
+ and the jwt feature is used and the jwt_symbolize_deeply?
21
+ configuration method is not used, then the session data will not
22
+ have the top-level data converted to symbols.
23
+
24
+ * If the Roda application defines a clear_session method in the scope,
25
+ that method is now called by Rodauth to clear the session data. This
26
+ is for better integration with the Roda sessions plugin.
@@ -179,6 +179,11 @@ module Rodauth
179
179
  auth_value_method(:"#{name}_additional_form_tags", nil)
180
180
  end
181
181
 
182
+ def session_key(meth, value)
183
+ define_method(meth){convert_session_key(value)}
184
+ auth_value_methods(meth)
185
+ end
186
+
182
187
  def auth_value_method(meth, value)
183
188
  define_method(meth){value}
184
189
  auth_value_methods(meth)
@@ -19,6 +19,8 @@ module Rodauth
19
19
  auth_value_method :accounts_table, :accounts
20
20
  auth_value_method :cache_templates, true
21
21
  auth_value_method :default_redirect, '/'
22
+ session_key :flash_error_key, :error
23
+ session_key :flash_notice_key, :notice
22
24
  auth_value_method :invalid_field_error_status, 422
23
25
  auth_value_method :invalid_key_error_status, 401
24
26
  auth_value_method :invalid_password_error_status, 401
@@ -36,7 +38,7 @@ module Rodauth
36
38
  auth_value_method :password_label, 'Password'
37
39
  auth_value_method :password_param, 'password'
38
40
  auth_value_method :modifications_require_password?, true
39
- auth_value_method :session_key, :account_id
41
+ session_key :session_key, :account_id
40
42
  auth_value_method :prefix, ''
41
43
  auth_value_method :require_bcrypt?, true
42
44
  auth_value_method :skip_status_checks?, true
@@ -181,7 +183,11 @@ module Rodauth
181
183
  end
182
184
 
183
185
  def clear_session
184
- session.clear
186
+ if scope.respond_to?(:clear_session)
187
+ scope.clear_session
188
+ else
189
+ session.clear
190
+ end
185
191
  end
186
192
 
187
193
  def login_required
@@ -197,19 +203,19 @@ module Rodauth
197
203
  end
198
204
 
199
205
  def set_error_flash(message)
200
- flash.now[:error] = message
206
+ flash.now[flash_error_key] = message
201
207
  end
202
208
 
203
209
  def set_redirect_error_flash(message)
204
- flash[:error] = message
210
+ flash[flash_error_key] = message
205
211
  end
206
212
 
207
213
  def set_notice_flash(message)
208
- flash[:notice] = message
214
+ flash[flash_notice_key] = message
209
215
  end
210
216
 
211
217
  def set_notice_now_flash(message)
212
- flash.now[:notice] = message
218
+ flash.now[flash_notice_key] = message
213
219
  end
214
220
 
215
221
  def require_login
@@ -330,6 +336,10 @@ module Rodauth
330
336
  # :nocov:
331
337
  end
332
338
 
339
+ def convert_session_key(key)
340
+ scope.opts[:sessions_convert_symbols] ? key.to_s : key
341
+ end
342
+
333
343
  def timing_safe_eql?(provided, actual)
334
344
  provided = provided.to_s
335
345
  Rack::Utils.secure_compare(provided.ljust(actual.length), actual) && provided.length == actual.length
@@ -11,6 +11,7 @@ module Rodauth
11
11
  before
12
12
  after
13
13
 
14
+ session_key :confirm_password_redirect_session_key, :confirm_password_redirect
14
15
  auth_value_methods :confirm_password_redirect
15
16
 
16
17
  auth_methods :confirm_password
@@ -46,7 +47,7 @@ module Rodauth
46
47
  end
47
48
 
48
49
  def confirm_password_redirect
49
- session.delete(:confirm_password_redirect) || default_redirect
50
+ session.delete(confirm_password_redirect_session_key) || default_redirect
50
51
  end
51
52
  end
52
53
  end
@@ -61,6 +61,8 @@ module Rodauth
61
61
  if session_data
62
62
  if jwt_symbolize_deeply?
63
63
  s = JSON.parse(JSON.fast_generate(session_data), :symbolize_names=>true)
64
+ elsif scope.opts[:sessions_convert_symbols]
65
+ s = session_data
64
66
  else
65
67
  session_data.each{|k,v| s[k.to_sym] = v}
66
68
  end
@@ -36,7 +36,7 @@ module Rodauth
36
36
  auth_value_method :unlock_account_email_subject, 'Unlock Account'
37
37
  auth_value_method :unlock_account_key_param, 'key'
38
38
  auth_value_method :unlock_account_requires_password?, false
39
- auth_value_method :unlock_account_session_key, :unlock_account_key
39
+ session_key :unlock_account_session_key, :unlock_account_key
40
40
 
41
41
  auth_value_methods(
42
42
  :unlock_account_redirect,
@@ -15,7 +15,7 @@ module Rodauth
15
15
  auth_value_method :password_expiration_table, :account_password_change_times
16
16
  auth_value_method :password_expiration_id_column, :id
17
17
  auth_value_method :password_expiration_changed_at_column, :changed_at
18
- auth_value_method :password_changed_at_session_key, :password_changed_at
18
+ session_key :password_changed_at_session_key, :password_changed_at
19
19
  auth_value_method :password_expiration_default, false
20
20
 
21
21
  auth_methods(
@@ -3,7 +3,7 @@
3
3
  module Rodauth
4
4
  Feature.define(:password_grace_period, :PasswordGracePeriod) do
5
5
  auth_value_method :password_grace_period, 300
6
- auth_value_method :last_password_entry_session_key, :last_password_entry
6
+ session_key :last_password_entry_session_key, :last_password_entry
7
7
 
8
8
  def modifications_require_password?
9
9
  return false unless super
@@ -19,7 +19,7 @@ module Rodauth
19
19
  auth_value_method :remember_cookie_options, {}
20
20
  auth_value_method :extend_remember_deadline?, false
21
21
  auth_value_method :remember_period, {:days=>14}
22
- auth_value_method :remembered_session_key, :remembered
22
+ session_key :remembered_session_key, :remembered
23
23
  auth_value_method :remember_deadline_interval, {:days=>14}
24
24
  auth_value_method :remember_id_column, :id
25
25
  auth_value_method :remember_key_column, :key
@@ -31,7 +31,7 @@ module Rodauth
31
31
  auth_value_method :reset_password_table, :account_password_reset_keys
32
32
  auth_value_method :reset_password_id_column, :id
33
33
  auth_value_method :reset_password_key_column, :key
34
- auth_value_method :reset_password_session_key, :reset_password_key
34
+ session_key :reset_password_session_key, :reset_password_key
35
35
 
36
36
  auth_value_methods :reset_password_email_sent_redirect, :reset_password_request_link
37
37
 
@@ -5,10 +5,10 @@ module Rodauth
5
5
  error_flash "This session has expired, please login again."
6
6
 
7
7
  auth_value_method :max_session_lifetime, 86400
8
- auth_value_method :session_created_session_key, :session_created_at
8
+ session_key :session_created_session_key, :session_created_at
9
9
  auth_value_method :session_expiration_default, true
10
10
  auth_value_method :session_inactivity_timeout, 1800
11
- auth_value_method :session_last_activity_session_key, :last_session_activity_at
11
+ session_key :session_last_activity_session_key, :last_session_activity_at
12
12
 
13
13
  auth_value_methods :session_expiration_redirect
14
14
 
@@ -7,7 +7,7 @@ module Rodauth
7
7
 
8
8
  auth_value_method :single_session_id_column, :id
9
9
  auth_value_method :single_session_key_column, :key
10
- auth_value_method :single_session_session_key, :single_session_key
10
+ session_key :single_session_session_key, :single_session_key
11
11
  auth_value_method :single_session_table, :account_session_keys
12
12
 
13
13
  auth_methods(
@@ -17,8 +17,8 @@ module Rodauth
17
17
  auth_value_method :two_factor_need_authentication_error_status, 401
18
18
  auth_value_method :two_factor_not_setup_error_status, 403
19
19
 
20
- auth_value_method :two_factor_session_key, :two_factor_auth
21
- auth_value_method :two_factor_setup_session_key, :two_factor_auth_setup
20
+ session_key :two_factor_session_key, :two_factor_auth
21
+ session_key :two_factor_setup_session_key, :two_factor_auth_setup
22
22
  auth_value_method :two_factor_need_setup_redirect, nil
23
23
 
24
24
  auth_value_methods(
@@ -31,7 +31,7 @@ module Rodauth
31
31
  auth_value_method :verify_account_table, :account_verification_keys
32
32
  auth_value_method :verify_account_id_column, :id
33
33
  auth_value_method :verify_account_key_column, :key
34
- auth_value_method :verify_account_session_key, :verify_account_key
34
+ session_key :verify_account_session_key, :verify_account_key
35
35
  auth_value_method :verify_account_set_password?, false
36
36
 
37
37
  auth_methods(
@@ -7,7 +7,7 @@ module Rodauth
7
7
  redirect :unverified_change_login
8
8
 
9
9
  auth_value_method :verification_requested_at_column, :requested_at
10
- auth_value_method :unverified_account_session_key, :unverified_account
10
+ session_key :unverified_account_session_key, :unverified_account
11
11
  auth_value_method :verify_account_grace_period, 86400
12
12
 
13
13
  auth_methods(
@@ -23,7 +23,7 @@ module Rodauth
23
23
  auth_value_method :verify_login_change_key_column, :key
24
24
  auth_value_method :verify_login_change_key_param, 'key'
25
25
  auth_value_method :verify_login_change_login_column, :login
26
- auth_value_method :verify_login_change_session_key, :verify_login_change_key
26
+ session_key :verify_login_change_session_key, :verify_login_change_key
27
27
  auth_value_method :verify_login_change_table, :account_login_change_keys
28
28
 
29
29
  auth_methods(
@@ -6,7 +6,7 @@ module Rodauth
6
6
  MAJOR = 1
7
7
 
8
8
  # The minor version of Rodauth, updated for new feature releases of Rodauth.
9
- MINOR = 17
9
+ MINOR = 18
10
10
 
11
11
  # The patch version of Rodauth, updated only for bug fixes from the last
12
12
  # feature release.
@@ -84,8 +84,8 @@ describe 'Rodauth create_account feature' do
84
84
  end
85
85
  roda do |r|
86
86
  r.rodauth
87
- next unless session[:account_id]
88
- r.root{view :content=>"Logged In: #{DB[:accounts].where(:id=>session[:account_id]).get(:email)}"}
87
+ next unless rodauth.logged_in?
88
+ r.root{view :content=>"Logged In: #{DB[:accounts].where(:id=>rodauth.session_value).get(:email)}"}
89
89
  end
90
90
 
91
91
  visit '/create-account'
@@ -5,7 +5,7 @@ describe 'Rodauth login feature' do
5
5
  rodauth{enable :login, :logout}
6
6
  roda do |r|
7
7
  r.rodauth
8
- next unless session[:account_id]
8
+ next unless rodauth.logged_in?
9
9
  r.root{view :content=>"Logged In"}
10
10
  end
11
11
 
@@ -41,7 +41,7 @@ describe 'Rodauth login feature' do
41
41
  end
42
42
  roda do |r|
43
43
  r.rodauth
44
- next unless session[:account_id]
44
+ next unless rodauth.logged_in?
45
45
  r.root{view :content=>"Logged In"}
46
46
  end
47
47
 
@@ -58,13 +58,13 @@ describe 'Rodauth login feature' do
58
58
  roda do |r|
59
59
  r.post 'login' do
60
60
  if r.params['login'] == 'apple' && r.params['password'] == 'banana'
61
- session[:user_id] = 'pear'
61
+ session['user_id'] = 'pear'
62
62
  r.redirect '/'
63
63
  end
64
64
  r.redirect '/login'
65
65
  end
66
66
  r.rodauth
67
- next unless session[:user_id] == 'pear'
67
+ next unless session['user_id'] == 'pear'
68
68
  r.root{"Logged In"}
69
69
  end
70
70
 
@@ -89,14 +89,14 @@ describe 'Rodauth login feature' do
89
89
  password == 'banana'
90
90
  end
91
91
  update_session do
92
- session[:user_id] = 'pear'
92
+ session['user_id'] = 'pear'
93
93
  end
94
94
  no_matching_login_message "no user"
95
95
  invalid_password_message "bad password"
96
96
  end
97
97
  roda do |r|
98
98
  r.rodauth
99
- next unless session[:user_id] == 'pear'
99
+ next unless session['user_id'] == 'pear'
100
100
  r.root{"Logged In"}
101
101
  end
102
102
 
@@ -116,7 +116,7 @@ describe 'Rodauth login feature' do
116
116
  rodauth do
117
117
  enable :login, :logout
118
118
  prefix 'auth'
119
- session_key :login_email
119
+ session_key 'login_email'
120
120
  account_from_session{DB[:accounts].first(:email=>session_value)}
121
121
  account_session_value{account[:email]}
122
122
  login_param{param('lp')}
@@ -132,7 +132,7 @@ describe 'Rodauth login feature' do
132
132
  r.on 'auth' do
133
133
  r.rodauth
134
134
  end
135
- next unless session[:login_email] =~ /example/
135
+ next unless session['login_email'] =~ /example/
136
136
  r.get('foo', :email){|e| "Logged In: #{e}"}
137
137
  end
138
138
  app.plugin :render, :views=>'spec/views', :engine=>'str'
@@ -223,7 +223,7 @@ describe 'Rodauth remember feature' do
223
223
  rodauth.load_memory
224
224
  r.redirect '/'
225
225
  end
226
- r.root{rodauth.logged_in? ? "Logged In#{session[:remembered]}" : "Not Logged In"}
226
+ r.root{rodauth.logged_in? ? "Logged In#{session[rodauth.remembered_session_key]}" : "Not Logged In"}
227
227
  end
228
228
 
229
229
  login
@@ -25,6 +25,25 @@ describe 'Rodauth' do
25
25
  page.title.must_equal 'Foo Login'
26
26
  end
27
27
 
28
+ it "should support flash_error_key and flash_notice_key" do
29
+ rodauth do
30
+ enable :login
31
+ template_opts(:layout_opts=>{:path=>'spec/views/layout-other.str'})
32
+ flash_error_key 'error2'
33
+ flash_notice_key 'notice2'
34
+ end
35
+ roda do |r|
36
+ r.rodauth
37
+ rodauth.require_login
38
+ view(:content=>'', :layout_opts=>{:path=>'spec/views/layout-other.str'})
39
+ end
40
+
41
+ visit '/'
42
+ page.html.must_include 'Please login to continue'
43
+ login(:visit=>false)
44
+ page.html.must_include 'You have been logged in'
45
+ end
46
+
28
47
  it "should work without preloading the templates" do
29
48
  @no_precompile = true
30
49
  rodauth do
@@ -263,10 +282,12 @@ describe 'Rodauth' do
263
282
  end
264
283
 
265
284
  it "should support :csrf=>false and :flash=>false plugin options" do
266
- rodauth{}
267
- roda(:csrf=>false, :flash=>false){}
268
- app.instance_variable_get(:@middleware).length.must_equal 1
269
- app.ancestors.map(&:to_s).wont_include 'Roda::RodaPlugins::Flash::InstanceMethods'
285
+ c = Class.new(Roda)
286
+ c.plugin(:rodauth, :csrf=>false, :flash=>false){}
287
+ c.route{}
288
+ c.instance_variable_get(:@middleware).length.must_equal 0
289
+ c.ancestors.map(&:to_s).wont_include 'Roda::RodaPlugins::Flash::InstanceMethods'
290
+ c.ancestors.map(&:to_s).wont_include 'Roda::RodaPlugins::RouteCsrf::InstanceMethods'
270
291
  end
271
292
 
272
293
  it "should inherit rodauth configuration in subclass" do
@@ -286,7 +307,7 @@ describe 'Rodauth' do
286
307
  page.html.must_equal 'foo'
287
308
 
288
309
  a = Class.new(app)
289
- a.plugin(:rodauth){auth_class_eval{def foo; "#{super}bar" end}}
310
+ a.plugin(:rodauth, rodauth_opts){auth_class_eval{def foo; "#{super}bar" end}}
290
311
  a.rodauth.superclass.must_equal auth_class
291
312
 
292
313
  visit '/'
@@ -13,8 +13,8 @@ describe 'Rodauth session expiration feature' do
13
13
  roda do |r|
14
14
  rodauth.check_session_expiration
15
15
  r.rodauth
16
- r.get("remove-creation"){session.delete(:session_created_at); r.redirect '/'}
17
- r.get("set-creation"){session[:session_created_at] = Time.now.to_i - 100000; r.redirect '/'}
16
+ r.get("remove-creation"){session.delete(rodauth.session_created_session_key); r.redirect '/'}
17
+ r.get("set-creation"){session[rodauth.session_created_session_key] = Time.now.to_i - 100000; r.redirect '/'}
18
18
  r.root{view :content=>rodauth.logged_in? ? "Logged In" : "Not Logged"}
19
19
  end
20
20
 
@@ -8,7 +8,7 @@ describe 'Rodauth single session feature' do
8
8
  roda do |r|
9
9
  rodauth.check_single_session
10
10
  r.rodauth
11
- r.is("clear"){session.delete(:single_session_key); DB[:account_session_keys].delete; r.redirect '/'}
11
+ r.is("clear"){session.delete(rodauth.single_session_session_key); DB[:account_session_keys].delete; r.redirect '/'}
12
12
  r.root{view :content=>rodauth.logged_in? ? "Logged In" : "Not Logged"}
13
13
  end
14
14
 
@@ -29,6 +29,7 @@ require 'capybara'
29
29
  require 'capybara/dsl'
30
30
  require 'rack/test'
31
31
  require 'stringio'
32
+ require 'securerandom'
32
33
 
33
34
  ENV['MT_NO_PLUGINS'] = '1' # Work around stupid autoloading of plugins
34
35
  gem 'minitest'
@@ -72,9 +73,23 @@ ENV['RACK_ENV'] = 'test'
72
73
  end
73
74
 
74
75
  Base = Class.new(Roda)
76
+ Base.plugin :flash
75
77
  Base.plugin :render, :layout_opts=>{:path=>'spec/views/layout.str'}
76
78
  Base.plugin(:not_found){raise "path #{request.path_info} not found"}
77
- Base.use Rack::Session::Cookie, :secret=>'0123456789'
79
+
80
+ if defined?(Roda::RodaVersionNumber) && Roda::RodaVersionNumber >= 30100
81
+ if ENV['RODA_ROUTE_CSRF'] == '0'
82
+ require 'roda/session_middleware'
83
+ Base.opts[:sessions_convert_symbols] = true
84
+ Base.use RodaSessionMiddleware, :secret=>SecureRandom.random_bytes(64), :key=>'rack.session'
85
+ else
86
+ ENV['RODA_ROUTE_CSRF'] ||= '1'
87
+ Base.plugin :sessions, :secret=>SecureRandom.random_bytes(64), :key=>'rack.session'
88
+ end
89
+ else
90
+ Base.use Rack::Session::Cookie, :secret => '0123456789'
91
+ end
92
+
78
93
  class Base
79
94
  attr_writer :title
80
95
  end
@@ -200,7 +215,8 @@ class Minitest::HooksSpec
200
215
  "SCRIPT_NAME" => "",
201
216
  "CONTENT_TYPE" => params.delete(:content_type) || "application/json",
202
217
  "SERVER_NAME" => 'example.com',
203
- "rack.input"=>StringIO.new((params || {}).to_json)
218
+ "rack.input"=>StringIO.new((params || {}).to_json),
219
+ "rack.errors"=>$stderr
204
220
  }
205
221
 
206
222
  if @authorization
@@ -215,7 +231,11 @@ class Minitest::HooksSpec
215
231
  r = @app.call(env)
216
232
 
217
233
  if cookie = r[1]['Set-Cookie']
218
- @cookie = cookie
234
+ if cookie.include?('expires=Thu, 01 Jan 1970 00:00:00 -0000')
235
+ @cookie = nil
236
+ else
237
+ @cookie = cookie.split(';', 2)[0]
238
+ end
219
239
  end
220
240
  if authorization = r[1]['Authorization']
221
241
  @authorization = authorization
@@ -11,7 +11,7 @@ describe 'Rodauth update_password feature' do
11
11
  end
12
12
  roda do |r|
13
13
  r.rodauth
14
- next unless session[:account_id]
14
+ next unless rodauth.logged_in?
15
15
  rodauth.account_from_session
16
16
  r.root{rodauth.send(:get_password_hash)}
17
17
  end
@@ -4,8 +4,8 @@
4
4
  <title>Foo #{@title}</title>
5
5
  </head>
6
6
  <body>
7
- #{"<div id='error_flash'>#{flash[:error]}</div>" if flash[:error]}
8
- #{"<div id='notice_flash'>#{flash[:notice]}</div>" if flash[:notice]}
7
+ #{"<div id='error_flash'>#{flash['error2']}</div>" if flash['error2']}
8
+ #{"<div id='notice_flash'>#{flash['notice2']}</div>" if flash['notice2']}
9
9
  #{yield}
10
10
  </body>
11
11
  </html>
@@ -4,8 +4,8 @@
4
4
  <title>#{@title}</title>
5
5
  </head>
6
6
  <body>
7
- #{"<div id='error_flash'>#{flash[:error]}</div>" if flash[:error]}
8
- #{"<div id='notice_flash'>#{flash[:notice]}</div>" if flash[:notice]}
7
+ #{"<div id='error_flash'>#{opts[:sessions_convert_symbols] ? flash['error'] : flash[:error]}</div>" if opts[:sessions_convert_symbols] ? flash['error'] : flash[:error]}
8
+ #{"<div id='notice_flash'>#{opts[:sessions_convert_symbols] ? flash['notice'] : flash[:notice]}</div>" if opts[:sessions_convert_symbols] ? flash['notice'] : flash[:notice]}
9
9
  #{yield}
10
10
  </body>
11
11
  </html>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.0
4
+ version: 1.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-11 00:00:00.000000000 Z
11
+ date: 2018-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -248,6 +248,7 @@ extra_rdoc_files:
248
248
  - doc/release_notes/1.7.0.txt
249
249
  - doc/release_notes/1.8.0.txt
250
250
  - doc/release_notes/1.9.0.txt
251
+ - doc/release_notes/1.18.0.txt
251
252
  files:
252
253
  - CHANGELOG
253
254
  - MIT-LICENSE
@@ -287,6 +288,7 @@ files:
287
288
  - doc/release_notes/1.15.0.txt
288
289
  - doc/release_notes/1.16.0.txt
289
290
  - doc/release_notes/1.17.0.txt
291
+ - doc/release_notes/1.18.0.txt
290
292
  - doc/release_notes/1.2.0.txt
291
293
  - doc/release_notes/1.3.0.txt
292
294
  - doc/release_notes/1.4.0.txt