mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
better flow for current site check
This commit is contained in:
parent
59dbc1b2e1
commit
1beedb79b1
3 changed files with 9 additions and 8 deletions
|
@ -78,7 +78,3 @@ post '/signout' do
|
|||
signout
|
||||
redirect '/'
|
||||
end
|
||||
|
||||
def signout
|
||||
session[:id] = nil
|
||||
end
|
||||
|
|
|
@ -88,7 +88,6 @@ end
|
|||
|
||||
def require_login_file_upload_ajax
|
||||
file_upload_response 'You are not signed in!' unless signed_in?
|
||||
file_upload_response 'Please contact support.' if banned?
|
||||
end
|
||||
|
||||
post '/site_files/upload' do
|
||||
|
|
|
@ -19,7 +19,14 @@ def require_login
|
|||
end
|
||||
|
||||
def signed_in?
|
||||
!session[:id].nil?
|
||||
return false if current_site.nil?
|
||||
true
|
||||
end
|
||||
|
||||
def signout
|
||||
@_site = nil
|
||||
@_parent_site = nil
|
||||
session[:id] = nil
|
||||
end
|
||||
|
||||
def current_site
|
||||
|
@ -29,7 +36,6 @@ def current_site
|
|||
|
||||
if @_site.is_banned || @_site.is_deleted || (@_parent_site && (@_parent_site.is_banned || @_parent_site.is_deleted))
|
||||
signout
|
||||
redirect '/'
|
||||
end
|
||||
|
||||
@_site
|
||||
|
|
Loading…
Add table
Reference in a new issue