forked from External/greenlight
test sessions controller and fix style
This commit is contained in:
@ -1,10 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class SessionsController < ApplicationController
|
||||
# GET /users/login
|
||||
def new
|
||||
end
|
||||
|
||||
# GET /users/logout
|
||||
def destroy
|
||||
logout
|
||||
@ -14,7 +10,7 @@ class SessionsController < ApplicationController
|
||||
# POST /users/login
|
||||
def create
|
||||
user = User.find_by(email: session_params[:email])
|
||||
if user.&authenticate(session_params[:password])
|
||||
if user&.authenticate(session_params[:password])
|
||||
login(user)
|
||||
end
|
||||
end
|
||||
@ -35,6 +31,9 @@ class SessionsController < ApplicationController
|
||||
def omniauth
|
||||
user = User.from_omniauth(request.env['omniauth.auth'])
|
||||
login(user)
|
||||
rescue => e
|
||||
logger.error "Error authenticating via omniauth: #{e}"
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
# POST /auth/failure
|
||||
|
Reference in New Issue
Block a user