check current user session

This commit is contained in:
Yan
2018-03-20 14:32:08 +06:30
parent e3f9ecbc87
commit 510e3aabec
8 changed files with 60 additions and 17 deletions

View File

@@ -33,10 +33,10 @@ module LoginVerification
protected
# Authenticate the user with token based authentication
def authenticate
authenticate_session_token || render_unauthorized
authenticate_session_token || render_unauthorized
end
def authenticate_session_token
def authenticate_session_token
token = session[:session_token]
if (token)
#@current_user = User.find_by(api_key: token)
@@ -50,7 +50,7 @@ module LoginVerification
end
end
def render_unauthorized()
def render_unauthorized
redirect_to root_path
end