Allow auth providers to provide custom urls

This commit is contained in:
Robin Ward 2016-04-20 13:19:38 -04:00
parent 180c972b58
commit c423ce6333
No known key found for this signature in database
GPG key ID: 0E091E2B4ED1B83D
2 changed files with 3 additions and 2 deletions

View file

@ -129,7 +129,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
if(customLogin){ if(customLogin){
customLogin(); customLogin();
} else { } else {
var authUrl = Discourse.getURL("/auth/" + name); const authUrl = loginMethod.get('customUrl') || Discourse.getURL("/auth/" + name);
if (loginMethod.get("fullScreenLogin")) { if (loginMethod.get("fullScreenLogin")) {
window.location = authUrl; window.location = authUrl;
} else { } else {

View file

@ -2,7 +2,7 @@ class Plugin::AuthProvider
def self.auth_attributes def self.auth_attributes
[:glyph, :background_color, :title, :message, :frame_width, :frame_height, :authenticator, [:glyph, :background_color, :title, :message, :frame_width, :frame_height, :authenticator,
:title_setting, :enabled_setting, :full_screen_login] :title_setting, :enabled_setting, :full_screen_login, :custom_url]
end end
attr_accessor(*auth_attributes) attr_accessor(*auth_attributes)
@ -13,6 +13,7 @@ class Plugin::AuthProvider
def to_json def to_json
result = {name: name} result = {name: name}
result['customUrl'] = custom_url if custom_url
result['titleOverride'] = title if title result['titleOverride'] = title if title
result['titleSetting'] = title_setting if title_setting result['titleSetting'] = title_setting if title_setting
result['enabledSetting'] = enabled_setting if enabled_setting result['enabledSetting'] = enabled_setting if enabled_setting