Null session id fix
This commit is contained in:
parent
58a34fb3a8
commit
970400cb74
app/controllers
|
@ -2,8 +2,12 @@
|
|||
class ArtistController < ApplicationController
|
||||
require 'open-uri'
|
||||
def view
|
||||
unless MainController.logged_in request.session['session_id']
|
||||
unless request.session['session_id'].nil? or MainController.logged_in request.session['session_id']
|
||||
redirect_to '/login'
|
||||
else
|
||||
if request.session['session_id'].nil?
|
||||
redirect_to '/login'
|
||||
end
|
||||
end
|
||||
if params[:name].nil?
|
||||
name = ''
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
class MainController < ApplicationController
|
||||
def index
|
||||
unless MainController.logged_in request.session['session_id']
|
||||
# Dirty auth block START
|
||||
unless request.session['session_id'].nil? or MainController.logged_in request.session['session_id']
|
||||
redirect_to '/login'
|
||||
else
|
||||
if request.session['session_id'].nil?
|
||||
redirect_to '/login'
|
||||
end
|
||||
end
|
||||
# Dirty auth block END
|
||||
end
|
||||
def self.logged_in session_id
|
||||
user_data = User.collection.find({session_key: Digest::SHA256.hexdigest(session_id)}).first
|
||||
|
|
Loading…
Reference in New Issue