mirror of
https://github.com/documize/community.git
synced 2025-08-04 21:15:24 +02:00
support for license keys
This commit is contained in:
parent
b0d70e2657
commit
3f87401d49
10 changed files with 252 additions and 35 deletions
|
@ -16,14 +16,14 @@ const {
|
|||
} = Ember;
|
||||
|
||||
export default Ember.Component.extend({
|
||||
SMTPHostEmptyError: computed.empty('model.global.host'),
|
||||
SMTPPortEmptyError: computed.empty('model.global.port'),
|
||||
SMTPSenderEmptyError: computed.empty('model.global.sender'),
|
||||
SMTPUserIdEmptyError: computed.empty('model.global.userid'),
|
||||
SMTPPasswordEmptyError: computed.empty('model.global.password'),
|
||||
SMTPHostEmptyError: computed.empty('model.smtp.host'),
|
||||
SMTPPortEmptyError: computed.empty('model.smtp.port'),
|
||||
SMTPSenderEmptyError: computed.empty('model.smtp.sender'),
|
||||
SMTPUserIdEmptyError: computed.empty('model.smtp.userid'),
|
||||
SMTPPasswordEmptyError: computed.empty('model.smtp.password'),
|
||||
|
||||
actions: {
|
||||
save() {
|
||||
saveSMTP() {
|
||||
if (this.get('SMTPHostEmptyError')) {
|
||||
$("#smtp-host").focus();
|
||||
return;
|
||||
|
@ -45,7 +45,12 @@ export default Ember.Component.extend({
|
|||
return;
|
||||
}
|
||||
|
||||
this.get('save')().then(() => {
|
||||
this.get('saveSMTP')().then(() => {
|
||||
});
|
||||
},
|
||||
|
||||
saveLicense() {
|
||||
this.get('saveLicense')().then(() => {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,9 +16,17 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
global: Ember.inject.service(),
|
||||
|
||||
actions: {
|
||||
save() {
|
||||
saveSMTP() {
|
||||
if(this.get('session.isGlobalAdmin')) {
|
||||
return this.get('global').saveConfig(this.model.global).then(() => {
|
||||
return this.get('global').saveSMTPConfig(this.model.smtp).then(() => {
|
||||
this.showNotification('Saved');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
saveLicense() {
|
||||
if(this.get('session.isGlobalAdmin')) {
|
||||
return this.get('global').saveLicense(this.model.license).then(() => {
|
||||
this.showNotification('Saved');
|
||||
});
|
||||
}
|
||||
|
|
|
@ -26,7 +26,8 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
|
||||
model() {
|
||||
return RSVP.hash({
|
||||
global: this.get('global').getConfig()
|
||||
smtp: this.get('global').getSMTPConfig(),
|
||||
license: this.get('global').getLicense()
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
{{global-settings model=model save=(action 'save')}}
|
||||
{{global-settings model=model saveSMTP=(action 'saveSMTP') saveLicense=(action 'saveLicense')}}
|
||||
|
|
|
@ -21,10 +21,10 @@ export default Ember.Service.extend({
|
|||
appMeta: service(),
|
||||
store: service(),
|
||||
|
||||
// Returns global configuration.
|
||||
getConfig() {
|
||||
// Returns SMTP configuration.
|
||||
getSMTPConfig() {
|
||||
if(this.get('sessionService.isGlobalAdmin')) {
|
||||
return this.get('ajax').request(`global`, {
|
||||
return this.get('ajax').request(`global/smtp`, {
|
||||
method: 'GET'
|
||||
}).then((response) => {
|
||||
return response;
|
||||
|
@ -32,13 +32,36 @@ export default Ember.Service.extend({
|
|||
}
|
||||
},
|
||||
|
||||
// Saves global configuration.
|
||||
saveConfig(config) {
|
||||
// Saves SMTP configuration.
|
||||
saveSMTPConfig(config) {
|
||||
if(this.get('sessionService.isGlobalAdmin')) {
|
||||
return this.get('ajax').request(`global`, {
|
||||
return this.get('ajax').request(`global/smtp`, {
|
||||
method: 'PUT',
|
||||
data: JSON.stringify(config)
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// Returns product license.
|
||||
getLicense() {
|
||||
if(this.get('sessionService.isGlobalAdmin')) {
|
||||
return this.get('ajax').request(`global/license`, {
|
||||
method: 'GET',
|
||||
dataType: "text"
|
||||
}).then((response) => {
|
||||
return response;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// Saves product license
|
||||
saveLicense(license) {
|
||||
if(this.get('sessionService.isGlobalAdmin')) {
|
||||
return this.get('ajax').request(`global/license`, {
|
||||
method: 'PUT',
|
||||
dataType: 'text',
|
||||
data: license
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,32 +1,48 @@
|
|||
<form class="form-bordered">
|
||||
<div class="form-header">
|
||||
<div class="title">Global Settings</div>
|
||||
<div class="tip">Settings applicable for all tenants</div>
|
||||
<div class="title">Mail Server Settings</div>
|
||||
<div class="tip">Used for sending email notifications</div>
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>SMTP Host</label>
|
||||
<div class="tip">e.g. my.host.com</div>
|
||||
{{focus-input id="smtp-host" type="text" value=model.global.host class=(if SMTPHostEmptyError 'error')}}
|
||||
{{focus-input id="smtp-host" type="text" value=model.smtp.host class=(if SMTPHostEmptyError 'error')}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>SMTP Port</label>
|
||||
<div class="tip">e.g. 587</div>
|
||||
{{input id="smtp-port" type="text" value=model.global.port class=(if SMTPPortEmptyError 'error')}}
|
||||
{{input id="smtp-port" type="text" value=model.smtp.port class=(if SMTPPortEmptyError 'error')}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>SMTP Sender</label>
|
||||
<div class="tip">e.g. noreply@documize.com</div>
|
||||
{{input id="smtp-sender" type="text" value=model.global.sender class=(if SMTPSenderEmptyError 'error')}}
|
||||
{{input id="smtp-sender" type="text" value=model.smtp.sender class=(if SMTPSenderEmptyError 'error')}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>SMTP User ID</label>
|
||||
<div class="tip">Your credentials</div>
|
||||
{{input id="smtp-userid" type="text" value=model.global.userid class=(if SMTPUserIdEmptyError 'error')}}
|
||||
{{input id="smtp-userid" type="text" value=model.smtp.userid class=(if SMTPUserIdEmptyError 'error')}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>SMTP Password</label>
|
||||
<div class="tip">Your credentials</div>
|
||||
{{input id="smtp-password" type="text" value=model.global.password class=(if SMTPPasswordEmptyError 'error')}}
|
||||
{{input id="smtp-password" type="text" value=model.smtp.password class=(if SMTPPasswordEmptyError 'error')}}
|
||||
</div>
|
||||
<div class="regular-button button-blue" {{ action 'save' }}>save</div>
|
||||
<div class="regular-button button-blue" {{ action 'saveSMTP' }}>save</div>
|
||||
</form>
|
||||
|
||||
<div class="margin-top-50">
|
||||
</div>
|
||||
|
||||
<form class="form-bordered">
|
||||
<div class="form-header">
|
||||
<div class="title">Edition License</div>
|
||||
<div class="tip">Product license</div>
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>License XML</label>
|
||||
<div class="tip">Please provide valid XML</div>
|
||||
{{textarea value=model.license rows="5"}}
|
||||
</div>
|
||||
<div class="regular-button button-blue" {{ action 'saveLicense' }}>save</div>
|
||||
</form>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue