add ldap authentication

This commit is contained in:
Joshua Arts
2018-07-20 14:20:14 -04:00
parent 7c0c944cb4
commit 775285bba9
10 changed files with 92 additions and 57 deletions

View File

@ -1,6 +1,8 @@
# frozen_string_literal: true
class SessionsController < ApplicationController
skip_before_action :verify_authenticity_token, only: [:omniauth, :fail]
# GET /users/logout
def destroy
logout
@ -13,7 +15,7 @@ class SessionsController < ApplicationController
if user.try(:authenticate, session_params[:password])
login(user)
else
redirect_to root_path, notice: I18n.t("login_failed")
redirect_to root_path, notice: I18n.t("invalid_credentials")
end
end
@ -28,7 +30,7 @@ class SessionsController < ApplicationController
# POST /auth/failure
def fail
redirect_to root_path
redirect_to root_path, notice: I18n.t(params[:message], default: I18n.t("omniauth_error"))
end
private