Fixed web password protection (was broken by earlier refactoring), also adcded some user-friendlines to it
This commit is contained in:
parent
c73db9ff5d
commit
ae7ac63a9d
3 changed files with 18 additions and 14 deletions
|
@ -31,7 +31,7 @@ class ApplicationController < ActionController::Base
|
|||
if in_a_web? and
|
||||
not authorized? and
|
||||
not %w( login authenticate published ).include?(@action_name)
|
||||
redirect_to :action => 'login'
|
||||
redirect_to :action => 'login', :web => @web_name
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
@ -72,6 +72,15 @@ class ApplicationController < ActionController::Base
|
|||
not @web_name.nil?
|
||||
end
|
||||
|
||||
def password_check(password)
|
||||
if password == @web.password
|
||||
cookies['web_address'] = password
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def password_error(password)
|
||||
if password.nil? or password.empty?
|
||||
'Please enter the password.'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue