diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/controllers/user_sessions_controller.rb | 5 | ||||
-rw-r--r-- | app/views/user_sessions/new.html.haml | 2 |
3 files changed, 5 insertions, 3 deletions
@@ -5,6 +5,7 @@ v7.13.0 - Implemented "rake env:info". Rake task to receive system information - Fix coverage calculation on commit page - Enhance YAML validation + - Redirect back after authorization v7.12.1 - Runner without tag should pick builds without tag only diff --git a/app/controllers/user_sessions_controller.rb b/app/controllers/user_sessions_controller.rb index 5700615..2f972bc 100644 --- a/app/controllers/user_sessions_controller.rb +++ b/app/controllers/user_sessions_controller.rb @@ -10,7 +10,8 @@ class UserSessionsController < ApplicationController def auth redirect_to client.auth_code.authorize_url({ - redirect_uri: callback_user_sessions_url + redirect_uri: callback_user_sessions_url, + state: params[:return_to] }) end @@ -21,7 +22,7 @@ class UserSessionsController < ApplicationController user = @user_session.authenticate(access_token: token) if user && sign_in(user) - redirect_to root_path + redirect_to(params[:state] || root_path) else @error = 'Invalid credentials' render :new diff --git a/app/views/user_sessions/new.html.haml b/app/views/user_sessions/new.html.haml index 5f33e09..b457e93 100644 --- a/app/views/user_sessions/new.html.haml +++ b/app/views/user_sessions/new.html.haml @@ -4,5 +4,5 @@ Make sure you have account on GitLab server = link_to GitlabCi.config.gitlab_server.url, GitlabCi.config.gitlab_server.url, no_turbolink %hr - = link_to "Login with GitLab", auth_user_sessions_path, no_turbolink.merge( class: 'btn btn-login btn-success' ) + = link_to "Login with GitLab", auth_user_sessions_path(return_to: params[:return_to]), no_turbolink.merge( class: 'btn btn-login btn-success' ) |