mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 00:03:37 +08:00
32 lines
1.1 KiB
Ruby
32 lines
1.1 KiB
Ruby
class Plugin::AuthProvider
|
|
|
|
def self.auth_attributes
|
|
[:glyph, :background_color, :pretty_name, :title, :message, :frame_width, :frame_height, :authenticator,
|
|
:pretty_name_setting, :title_setting, :enabled_setting, :full_screen_login, :full_screen_login_setting,
|
|
:custom_url]
|
|
end
|
|
|
|
attr_accessor(*auth_attributes)
|
|
|
|
def name
|
|
authenticator.name
|
|
end
|
|
|
|
def to_json
|
|
result = { name: name }
|
|
result['customUrl'] = custom_url if custom_url
|
|
result['prettyNameOverride'] = pretty_name || name
|
|
result['titleOverride'] = title if title
|
|
result['titleSetting'] = title_setting if title_setting
|
|
result['prettyNameSetting'] = pretty_name_setting if pretty_name_setting
|
|
result['enabledSetting'] = enabled_setting if enabled_setting
|
|
result['messageOverride'] = message if message
|
|
result['frameWidth'] = frame_width if frame_width
|
|
result['frameHeight'] = frame_height if frame_height
|
|
result['fullScreenLogin'] = full_screen_login if full_screen_login
|
|
result['fullScreenLoginSetting'] = full_screen_login_setting if full_screen_login_setting
|
|
result.to_json
|
|
end
|
|
|
|
end
|