Skip to content
Snippets Groups Projects
Commit 863b2ece authored by Ilya Kolodnik's avatar Ilya Kolodnik
Browse files

add error processing when access denied

parent 69d314b1
Branches
No related tags found
No related merge requests found
......@@ -14,6 +14,10 @@ class RedmineOauthController < AccountController
end
def oauth_google_callback
if params[:error]
flash[:error] = l(:notice_access_denied)
redirect_to signin_path
else
token = oauth_client.auth_code.get_token(params[:code], :redirect_uri => oauth_google_callback_url)
result = token.get('https://www.googleapis.com/oauth2/v1/userinfo')
info = JSON.parse(result.body)
......@@ -29,6 +33,7 @@ class RedmineOauthController < AccountController
redirect_to signin_path
end
end
end
def try_to_login info
params[:back_url] = session[:back_url]
......
en:
notice_unable_to_obtain_google_credentials: "Unable to obtain credentials from Google."
notice_domain_not_allowed: "You can not login using %{domain} domain."
notice_access_denied: "You must allow to use you Google credentials to enter this site."
login_via_google: "Login via Google"
ru:
notice_unable_to_obtain_google_credentials: "Не удалось получить данные от Google."
notice_domain_not_allowed: "Вы не можете войти в систему при помощи домена %{domain}."
notice_access_denied: "Для корректного входа необходимо разрешить приложению доступ к аккаунту."
login_via_google: "Войти с Google"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment