diff --git a/assets/javascripts/discourse/controllers/admin-wizards-api.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-api.js.es6 index 832bf1c4..2457a917 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-api.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-api.js.es6 @@ -59,7 +59,7 @@ export default Ember.Controller.extend({ }); } } else { - // basic auth + // basic auth - no need to authorize separately } window.location.href = authUrl + query; @@ -104,6 +104,7 @@ export default Ember.Controller.extend({ } const endpoints = api.endpoints; + if (endpoints.length) { data['endpoints'] = JSON.stringify(endpoints); } diff --git a/assets/javascripts/discourse/models/custom-wizard-api.js.es6 b/assets/javascripts/discourse/models/custom-wizard-api.js.es6 index 5f051cc9..726cebe0 100644 --- a/assets/javascripts/discourse/models/custom-wizard-api.js.es6 +++ b/assets/javascripts/discourse/models/custom-wizard-api.js.es6 @@ -24,6 +24,8 @@ CustomWizardApi.reopenClass({ tokenUrl: authorization.token_url, clientId: authorization.client_id, clientSecret: authorization.client_secret, + username: authorization.username, + password: authorization.password, authParams: Ember.A(authorization.auth_params), authorized: authorization.authorized, accessToken: authorization.access_token, diff --git a/assets/javascripts/discourse/templates/admin-wizards-api.hbs b/assets/javascripts/discourse/templates/admin-wizards-api.hbs index a17a0c0b..9d929985 100644 --- a/assets/javascripts/discourse/templates/admin-wizards-api.hbs +++ b/assets/javascripts/discourse/templates/admin-wizards-api.hbs @@ -45,15 +45,17 @@ {{i18n 'admin.wizard.api.auth.settings'}} - {{#if api.name}} -
-
- -
- {{api.redirectUri}} + {{#if isOauth}} + {{#if api.name}} +
+
+ +
+ {{api.redirectUri}} +
-
+ {{/if}} {{/if}}
@@ -63,21 +65,21 @@
-
- -
- {{input value=api.authUrl}} -
-
- -
- -
- {{input value=api.tokenUrl}} -
-
- {{#if isOauth}} +
+ +
+ {{input value=api.authUrl}} +
+
+ +
+ +
+ {{input value=api.tokenUrl}} +
+
+
@@ -105,59 +107,75 @@ {{d-button label='admin.wizard.api.auth.params.new' icon='plus' action='addParam'}}
+ {{else}} +
+ +
+ {{input value=api.username}} +
+
+ +
+ +
+ {{input value=api.password}} +
+
{{/if}}
-
-
- {{#if api.authorized}} - - {{i18n "admin.wizard.api.status.authorized"}} - {{else}} - - {{i18n "admin.wizard.api.status.not_authorized"}} - {{/if}} -
+ {{#if isOauth}} +
+
+ {{#if api.authorized}} + + {{i18n "admin.wizard.api.status.authorized"}} + {{else}} + + {{i18n "admin.wizard.api.status.not_authorized"}} + {{/if}} +
-
- {{i18n 'admin.wizard.api.status.label'}} -
+
+ {{i18n 'admin.wizard.api.status.label'}} +
-
- -
- {{api.code}} +
+ +
+ {{api.code}} +
+
+ +
+ +
+ {{api.accessToken}} +
+
+ +
+ +
+ {{api.refreshToken}} +
+
+ +
+ +
+ {{api.tokenExpiresAt}} +
+
+ +
+ +
+ {{api.tokenRefreshAt}} +
- -
- -
- {{api.accessToken}} -
-
- -
- -
- {{api.refreshToken}} -
-
- -
- -
- {{api.tokenExpiresAt}} -
-
- -
- -
- {{api.tokenRefreshAt}} -
-
-
+ {{/if}}
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index c14795d7..4bdbd5f9 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -149,6 +149,8 @@ en: token_url: "Token url" client_id: 'Client id' client_secret: 'Client secret' + username: 'username' + password: 'password' params: label: 'Params' new: 'New param'