working on cleaning up and testing if I can push changes to a PR
This commit is contained in:
@@ -9,7 +9,7 @@ class ApplicationController < ActionController::Base
|
|||||||
private
|
private
|
||||||
|
|
||||||
def current_user
|
def current_user
|
||||||
@current_user ||= User.find_by_auth_token(cookies[:auth_token].to_s)
|
@current_user ||= (User.find_by_auth_token(cookies[:auth_token].to_s) || User.find_by_user_id(session[:user_id].to_s))
|
||||||
end
|
end
|
||||||
|
|
||||||
def authenticated
|
def authenticated
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ class SessionsController < ApplicationController
|
|||||||
if params[:remember_me]
|
if params[:remember_me]
|
||||||
cookies.permanent[:auth_token] = user.auth_token if User.where(:user_id => user.user_id).exists?
|
cookies.permanent[:auth_token] = user.auth_token if User.where(:user_id => user.user_id).exists?
|
||||||
else
|
else
|
||||||
cookies[:auth_token] = user.auth_token if User.where(:user_id => user.user_id).exists?
|
session[:user_id] = user.user_id if User.where(:user_id => user.user_id).exists?
|
||||||
|
#cookies[:auth_token] = user.auth_token if User.where(:user_id => user.user_id).exists?
|
||||||
end
|
end
|
||||||
redirect_to path
|
redirect_to path
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user