<commit_before>class Users::SessionsController < Devise::SessionsController
	include UrlHelper
	require 'openssl'
	require 'base64'

	def sso
		SSO_SECRET = ENV["SSO_SECRET"]
		FORUM_URL = ENV["FORUM_URL"]

	  # authenticate
	  self.resource = warden.authenticate(auth_options)
	  resource_name = self.resource_name
	  sign_in(resource_name, resource)
	  if user_signed_in?
	    # redirect to forum
	    sig = params[:sig]
	    sso = params[:sso]
	    if OpenSSL::HMAC.hexdigest('sha256', SSO_SECRET, sso) == sig
	    	nonce = Base64.decode64(sso)
	    	sso = Base64.encode64(nonce + '&username=' + resource.username + '&email=' + resource.email + '&external_id=' + resource.id.to_s)
	    	sig = OpenSSL::HMAC.hexdigest('sha256', SSO_SECRET, sso)
	    	return_params = { sso: sso, sig: sig }
	    	redirect_to generate_url( FORUM_URL, return_params )
	    end
	  else
	  	redirect_to root_path, alert: t('.sign_in')
	  end
	end

end
<commit_msg>changed the redirect route<commit_after>class Users::SessionsController < Devise::SessionsController
	include UrlHelper
	require 'openssl'
	require 'base64'

	def sso
		SSO_SECRET = ENV["SSO_SECRET"]
		FORUM_URL = ENV["FORUM_URL"]

	  # authenticate
	  self.resource = warden.authenticate(auth_options)
	  resource_name = self.resource_name
	  sign_in(resource_name, resource)
	  if user_signed_in?
	    # redirect to forum
	    sig = params[:sig]
	    sso = params[:sso]
	    if OpenSSL::HMAC.hexdigest('sha256', SSO_SECRET, sso) == sig
	    	nonce = Base64.decode64(sso)
	    	sso = Base64.encode64(nonce + '&username=' + resource.username + '&email=' + resource.email + '&external_id=' + resource.id.to_s)
	    	sig = OpenSSL::HMAC.hexdigest('sha256', SSO_SECRET, sso)
	    	return_params = { sso: sso, sig: sig }
	    	redirect_to generate_url( FORUM_URL, return_params )
	    end
	  else
	  	redirect_to new_user_registration, alert: t('.sign_in')
	  end
	end

end

{'fraction_non_alphanumeric': 0.11488250652741515, 'fraction_numerical': 0.01671018276762402, 'mean_word_length': 3.8629441624365484, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '813567', 'n_tokens_mistral': 767, 'n_tokens_neox': 693, 'n_words': 139}