0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 17:30:29 +01:00

added basic auth interface changes and supporting code

Dieser Commit ist enthalten in:
Robert Barrow 2019-06-02 23:59:35 +01:00
Ursprung f331f80cbb
Commit cc98a14d15
4 geänderte Dateien mit 91 neuen und 68 gelöschten Zeilen

Datei anzeigen

@ -59,7 +59,7 @@ export default Ember.Controller.extend({
}); });
} }
} else { } else {
// basic auth // basic auth - no need to authorize separately
} }
window.location.href = authUrl + query; window.location.href = authUrl + query;
@ -104,6 +104,7 @@ export default Ember.Controller.extend({
} }
const endpoints = api.endpoints; const endpoints = api.endpoints;
if (endpoints.length) { if (endpoints.length) {
data['endpoints'] = JSON.stringify(endpoints); data['endpoints'] = JSON.stringify(endpoints);
} }

Datei anzeigen

@ -24,6 +24,8 @@ CustomWizardApi.reopenClass({
tokenUrl: authorization.token_url, tokenUrl: authorization.token_url,
clientId: authorization.client_id, clientId: authorization.client_id,
clientSecret: authorization.client_secret, clientSecret: authorization.client_secret,
username: authorization.username,
password: authorization.password,
authParams: Ember.A(authorization.auth_params), authParams: Ember.A(authorization.auth_params),
authorized: authorization.authorized, authorized: authorization.authorized,
accessToken: authorization.access_token, accessToken: authorization.access_token,

Datei anzeigen

@ -45,15 +45,17 @@
{{i18n 'admin.wizard.api.auth.settings'}} {{i18n 'admin.wizard.api.auth.settings'}}
</div> </div>
{{#if api.name}} {{#if isOauth}}
<div class="control-group redirect-uri"> {{#if api.name}}
<div class="control-label"> <div class="control-group redirect-uri">
<label>{{i18n 'admin.wizard.api.auth.redirect_uri'}}</label> <div class="control-label">
<div class="controls"> <label>{{i18n 'admin.wizard.api.auth.redirect_uri'}}</label>
{{api.redirectUri}} <div class="controls">
{{api.redirectUri}}
</div>
</div> </div>
</div> </div>
</div> {{/if}}
{{/if}} {{/if}}
<div class="control-group auth-type"> <div class="control-group auth-type">
@ -63,21 +65,21 @@
</div> </div>
</div> </div>
<div class="control-group">
<label>{{i18n 'admin.wizard.api.auth.url'}}</label>
<div class="controls">
{{input value=api.authUrl}}
</div>
</div>
<div class="control-group">
<label>{{i18n 'admin.wizard.api.auth.token_url'}}</label>
<div class="controls">
{{input value=api.tokenUrl}}
</div>
</div>
{{#if isOauth}} {{#if isOauth}}
<div class="control-group">
<label>{{i18n 'admin.wizard.api.auth.url'}}</label>
<div class="controls">
{{input value=api.authUrl}}
</div>
</div>
<div class="control-group">
<label>{{i18n 'admin.wizard.api.auth.token_url'}}</label>
<div class="controls">
{{input value=api.tokenUrl}}
</div>
</div>
<div class="control-group"> <div class="control-group">
<label>{{i18n 'admin.wizard.api.auth.client_id'}}</label> <label>{{i18n 'admin.wizard.api.auth.client_id'}}</label>
<div class="controls"> <div class="controls">
@ -105,59 +107,75 @@
{{d-button label='admin.wizard.api.auth.params.new' icon='plus' action='addParam'}} {{d-button label='admin.wizard.api.auth.params.new' icon='plus' action='addParam'}}
</div> </div>
</div> </div>
{{else}}
<div class="control-group">
<label>{{i18n 'admin.wizard.api.auth.username'}}</label>
<div class="controls">
{{input value=api.username}}
</div>
</div>
<div class="control-group">
<label>{{i18n 'admin.wizard.api.auth.password'}}</label>
<div class="controls">
{{input value=api.password}}
</div>
</div>
{{/if}} {{/if}}
</div> </div>
<div class="status"> {{#if isOauth}}
<div class="authorization"> <div class="status">
{{#if api.authorized}} <div class="authorization">
<span class="authorization-indicator authorized"></span> {{#if api.authorized}}
<span>{{i18n "admin.wizard.api.status.authorized"}}</span> <span class="authorization-indicator authorized"></span>
{{else}} <span>{{i18n "admin.wizard.api.status.authorized"}}</span>
<span class="authorization-indicator not-authorized"></span> {{else}}
<span>{{i18n "admin.wizard.api.status.not_authorized"}}</span> <span class="authorization-indicator not-authorized"></span>
{{/if}} <span>{{i18n "admin.wizard.api.status.not_authorized"}}</span>
</div> {{/if}}
</div>
<div class="wizard-header medium"> <div class="wizard-header medium">
{{i18n 'admin.wizard.api.status.label'}} {{i18n 'admin.wizard.api.status.label'}}
</div> </div>
<div class="control-group"> <div class="control-group">
<label>{{i18n 'admin.wizard.api.status.code'}}</label> <label>{{i18n 'admin.wizard.api.status.code'}}</label>
<div class="controls"> <div class="controls">
{{api.code}} {{api.code}}
</div>
</div>
<div class="control-group">
<label>{{i18n 'admin.wizard.api.status.access_token'}}</label>
<div class="controls">
{{api.accessToken}}
</div>
</div>
<div class="control-group">
<label>{{i18n 'admin.wizard.api.status.refresh_token'}}</label>
<div class="controls">
{{api.refreshToken}}
</div>
</div>
<div class="control-group">
<label>{{i18n 'admin.wizard.api.status.expires_at'}}</label>
<div class="controls">
{{api.tokenExpiresAt}}
</div>
</div>
<div class="control-group">
<label>{{i18n 'admin.wizard.api.status.refresh_at'}}</label>
<div class="controls">
{{api.tokenRefreshAt}}
</div>
</div> </div>
</div> </div>
{{/if}}
<div class="control-group">
<label>{{i18n 'admin.wizard.api.status.access_token'}}</label>
<div class="controls">
{{api.accessToken}}
</div>
</div>
<div class="control-group">
<label>{{i18n 'admin.wizard.api.status.refresh_token'}}</label>
<div class="controls">
{{api.refreshToken}}
</div>
</div>
<div class="control-group">
<label>{{i18n 'admin.wizard.api.status.expires_at'}}</label>
<div class="controls">
{{api.tokenExpiresAt}}
</div>
</div>
<div class="control-group">
<label>{{i18n 'admin.wizard.api.status.refresh_at'}}</label>
<div class="controls">
{{api.tokenRefreshAt}}
</div>
</div>
</div>
</div> </div>
<div class="wizard-header"> <div class="wizard-header">

Datei anzeigen

@ -149,6 +149,8 @@ en:
token_url: "Token url" token_url: "Token url"
client_id: 'Client id' client_id: 'Client id'
client_secret: 'Client secret' client_secret: 'Client secret'
username: 'username'
password: 'password'
params: params:
label: 'Params' label: 'Params'
new: 'New param' new: 'New param'