mirror of
https://github.com/documize/community.git
synced 2025-07-23 23:29:42 +02:00
License key workflow improved
Co-Authored-By: Saul S <sauls8t@users.noreply.github.com>
This commit is contained in:
parent
27fde0dac8
commit
30856433f8
6 changed files with 14 additions and 25 deletions
|
@ -200,15 +200,16 @@ func (h *Handler) SetLicense(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
h.Store.Setting.Set("EDITION-LICENSE", js)
|
h.Store.Setting.Set("EDITION-LICENSE", js)
|
||||||
|
|
||||||
ctx.Transaction, err = h.Runtime.Db.Beginx()
|
/* ctx.Transaction, err = h.Runtime.Db.Beginx()*/
|
||||||
if err != nil {
|
//if err != nil {
|
||||||
response.WriteServerError(w, method, err)
|
//response.WriteServerError(w, method, err)
|
||||||
return
|
//return
|
||||||
}
|
//}
|
||||||
|
|
||||||
ctx.Transaction.Commit()
|
/*ctx.Transaction.Commit()*/
|
||||||
|
|
||||||
h.Runtime.Log.Info("License changed")
|
h.Runtime.Log.Info("License changed")
|
||||||
|
|
||||||
event.Handler().Publish(string(event.TypeSystemLicenseChange))
|
event.Handler().Publish(string(event.TypeSystemLicenseChange))
|
||||||
|
|
||||||
h.Store.Audit.Record(ctx, audit.EventTypeSystemLicense)
|
h.Store.Audit.Record(ctx, audit.EventTypeSystemLicense)
|
||||||
|
|
|
@ -17,7 +17,8 @@ import Component from '@ember/component';
|
||||||
|
|
||||||
export default Component.extend(Notifier, {
|
export default Component.extend(Notifier, {
|
||||||
appMeta: service(),
|
appMeta: service(),
|
||||||
LicenseError: empty('model.license'),
|
global: service(),
|
||||||
|
LicenseError: empty('license'),
|
||||||
changelog: '',
|
changelog: '',
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
@ -38,7 +39,8 @@ export default Component.extend(Notifier, {
|
||||||
actions: {
|
actions: {
|
||||||
saveLicense() {
|
saveLicense() {
|
||||||
this.showWait();
|
this.showWait();
|
||||||
this.get('saveLicense')().then(() => {
|
|
||||||
|
this.get('global').saveLicense(this.get('license')).then(() => {
|
||||||
this.showDone();
|
this.showDone();
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,18 +9,7 @@
|
||||||
//
|
//
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
import { inject as service } from '@ember/service';
|
|
||||||
import Controller from '@ember/controller';
|
import Controller from '@ember/controller';
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
global: service(),
|
|
||||||
|
|
||||||
actions: {
|
|
||||||
saveLicense() {
|
|
||||||
if(this.get('session.isGlobalAdmin')) {
|
|
||||||
return this.get('global').saveLicense(this.model.license).then(() => {
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import Route from '@ember/routing/route';
|
import Route from '@ember/routing/route';
|
||||||
import RSVP from 'rsvp';
|
|
||||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||||
|
|
||||||
export default Route.extend(AuthenticatedRouteMixin, {
|
export default Route.extend(AuthenticatedRouteMixin, {
|
||||||
|
@ -26,9 +25,7 @@ export default Route.extend(AuthenticatedRouteMixin, {
|
||||||
},
|
},
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return RSVP.hash({
|
return this.get('global').getLicense();
|
||||||
license: this.get('global').getLicense()
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
activate() {
|
activate() {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{{customize/license-key model=model saveLicense=(action 'saveLicense')}}
|
{{customize/license-key license=model}}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<form class="mt-5 ">
|
<form class="mt-5 ">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="product-license-xml">Enterprise Edition license (optional)</label>
|
<label for="product-license-xml">Enterprise Edition license (optional)</label>
|
||||||
<textarea id="product-license-xml" rows=18 value={{model.license}} class={{if LicenseError 'form-control is-invalid' 'form-control'}}></textarea>
|
{{textarea id="product-license-xml" value=license rows="18" class=(if LicenseError 'form-control is-invalid' 'form-control')}}
|
||||||
<small class="form-text text-muted ">XML format</small>
|
<small class="form-text text-muted ">XML format</small>
|
||||||
{{#if appMeta.valid}}
|
{{#if appMeta.valid}}
|
||||||
<p class="mt-2 color-green">Valid</p>
|
<p class="mt-2 color-green">Valid</p>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue