7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/newsmast_mastodon/concerns/custom_authentication_behavior.rb', line 7
def create
if client_credentials? || authorization_code?
super
return
end
if NewsmastMastodon::LoginService.new(oauth_params).two_factor_enabled?
return render_error(I18n.t('login_service.errors.two_factor_enabled'))
end
error_message = if ENV.fetch('LOCAL_DOMAIN', nil) == 'thebristolcable.social' || Rails.env.development?
NewsmastMastodon::LoginService.new(oauth_params).bristol_cable_login || nil
elsif is_non_channel?
NewsmastMastodon::LoginService.new(oauth_params).non_channel_login || nil
else
NewsmastMastodon::LoginService.new(oauth_params).channel_login || nil
end
error_message.nil? ? super : render_error(error_message)
end
|