RS OAuth pre-fills username for login

This commit is contained in:
Râu Cao 2023-08-01 13:01:03 +02:00
parent a2d27bf575
commit 5f921f1b53
Signed by: raucao
GPG Key ID: 15E65F399D084BA9

View File

@ -1,5 +1,5 @@
class Rs::OauthController < ApplicationController
before_action :require_user_signed_in
before_action :require_signed_in_with_username
def new
username, org = params[:useraddress].split("@")
@ -97,6 +97,13 @@ class Rs::OauthController < ApplicationController
private
def require_signed_in_with_username
unless user_signed_in?
username, org = params[:useraddress].split("@")
redirect_to new_user_session_path(cn: username, ou: org)
end
end
def app_auth_url(auth)
url = "#{auth.url}#remotestorage=#{current_user.address}"
url += "&access_token=#{auth.token}"