@@ -35,18 +35,11 @@ class Mastodon < OmniAuth::Strategies::OAuth2
3535 # Before we can redirect the user to authorize access, we must know where the user is from
3636 # If the identifier param is not already present, a form will be shown for entering it
3737 def request_phase
38- puts "++++++++++request_phase"
39- puts identifier ? "true" : "false"
40- puts options [ :domain ]
41- puts options [ :client_id ]
42- puts options [ :client_secret ]
43- puts "++++++++++request_phase"
44- identifier ? start_oauth : get_identifier
38+ # identifier ? start_oauth : get_identifier
39+ start_oauth
4540 end
4641
4742 def callback_phase
48- puts "++++++++++callback_phase"
49- puts identifier
5043 set_options_from_identifier
5144 super
5245 end
@@ -57,9 +50,6 @@ def raw_info
5750
5851 def callback_url
5952 full_host + script_name + callback_path
60- puts "++++++++++callback_url"
61- puts identifier
62- puts full_host + script_name + callback_path
6353 end
6454
6555 def authorize_params
@@ -70,30 +60,26 @@ def authorize_params
7060
7161 private
7262
73- def get_identifier
74- I18n . with_locale ( locale ) do
75- form = OmniAuth ::Form . new ( title : translate ( '.omniauth.mastodon.title' ) )
76- form . text_field translate ( '.omniauth.mastodon.text' ) , 'identifier'
77- form . button translate ( '.omniauth.mastodon.button' )
78- form . to_response
79- end
80- end
81-
82- def translate ( t )
83- I18n . exists? ( t ) ? I18n . t ( t ) : I18n . t ( t , locale : :en )
84- end
85-
86- def locale
87- loc = request . params [ 'locale' ] || session [ :omniauth_login_locale ] || I18n . default_locale
88- loc = :en unless I18n . locale_available? ( loc )
89- loc
90- end
63+ # def get_identifier
64+ # I18n.with_locale(locale) do
65+ # form = OmniAuth::Form.new(title: translate('.omniauth.mastodon.title'))
66+ # form.text_field translate('.omniauth.mastodon.text'), 'identifier'
67+ # form.button translate('.omniauth.mastodon.button')
68+ # form.to_response
69+ # end
70+ # end
71+
72+ # def translate(t)
73+ # I18n.exists?(t) ? I18n.t(t) : I18n.t(t, locale: :en)
74+ # end
75+
76+ # def locale
77+ # loc = request.params['locale'] || session[:omniauth_login_locale] || I18n.default_locale
78+ # loc = :en unless I18n.locale_available?(loc)
79+ # loc
80+ # end
9181
9282 def start_oauth
93- puts "++++++++++start_oauth"
94- puts callback_url
95- puts authorize_params
96- puts "++++++++++start_oauth"
9783 set_options_from_identifier
9884 redirect client . auth_code . authorize_url ( { :redirect_uri => callback_url } . merge ( authorize_params ) )
9985 end
@@ -107,18 +93,14 @@ def identifier
10793 end
10894
10995 def set_options_from_identifier
110- username , domain = identifier . split ( '@' )
111- client_id , client_secret = options . credentials . call ( domain , callback_url )
112- puts "*-**-*"
113- puts username
114- puts domain
115- puts client_id
116- puts client_secret
117- puts "*-**-*"
118- options . identifier = identifier
119- options . client_options [ :site ] = "https://#{ domain } "
120- options . client_id = client_id
121- options . client_secret = client_secret
96+ # username, domain = identifier.split('@')
97+ domain = options [ :domain ]
98+ # client_id, client_secret = options.credentials.call(domain, callback_url)
99+ # options.identifier = identifier
100+ # options.client_options[:site] = "http://#{domain}"
101+ options . client_options [ :site ] = domain
102+ # options.client_id = client_id
103+ # options.client_secret = client_secret
122104 end
123105 end
124106 end
0 commit comments