fb2b4d8a8a
chore: fix api test conventions chore: rubocop -A spec/ chore: more rubocop -A fix failing test rubocop fixes removes helper methods that are in my opinion dead code more rubocop fixes rubocop -a --auto-gen-config
23 lines
884 B
Ruby
23 lines
884 B
Ruby
class DiscourseSsoController < DiscourseController
|
|
before_action -> { require_config_enabled :discourse_sso }
|
|
|
|
def sso
|
|
raise I18n.t('discourse.sso.invalid_signature') unless valid_signature?
|
|
|
|
payload = parse_payload
|
|
nonce = payload[:nonce]
|
|
return_sso_url = payload[:return_sso_url] || "#{discourse_url}/session/sso_login"
|
|
|
|
raise I18n.t('discourse.sso.nonce_missing') if nonce.blank?
|
|
|
|
redirect_to_with_payload return_sso_url,
|
|
nonce: nonce,
|
|
email: current_user.email,
|
|
require_activation: true,
|
|
external_id: "#{FoodsoftConfig.scope}/#{current_user.id}",
|
|
username: current_user.nick,
|
|
name: current_user.name
|
|
rescue StandardError => e
|
|
redirect_to root_url, alert: e.to_s
|
|
end
|
|
end
|