1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 05:09:42 +02:00

Show admins incomplete config indicator

SMTP checks to start with.
This commit is contained in:
sauls8t 2019-06-19 13:39:36 +01:00
parent b2cd375936
commit 80f0876b51
7 changed files with 31 additions and 4 deletions

View file

@ -27,6 +27,7 @@ import (
"github.com/documize/community/domain/auth"
"github.com/documize/community/domain/organization"
indexer "github.com/documize/community/domain/search"
"github.com/documize/community/domain/setting"
"github.com/documize/community/domain/store"
"github.com/documize/community/model/doc"
"github.com/documize/community/model/org"
@ -67,6 +68,13 @@ func (h *Handler) Meta(w http.ResponseWriter, r *http.Request) {
data.Storage = h.Runtime.StoreProvider.Type()
data.Location = h.Runtime.Flags.Location // reserved
// Is product setup complete? SMTP in this case.
data.Configured = true
cfg := setting.GetSMTPConfig(h.Store)
if len(cfg.Host) == 0 {
data.Configured = false
}
// Strip secrets
data.AuthConfig = auth.StripAuthSecrets(h.Runtime, org.AuthProvider, org.AuthConfig)

View file

@ -48,7 +48,6 @@ func (h *Handler) SMTP(w http.ResponseWriter, r *http.Request) {
var y map[string]interface{}
json.Unmarshal([]byte(config), &y)
j, err := json.Marshal(y)
if err != nil {
response.WriteBadRequestError(w, method, err.Error())

View file

@ -11,10 +11,12 @@
import $ from 'jquery';
import { empty } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import Notifier from '../../mixins/notifier';
import Component from '@ember/component';
export default Component.extend(Notifier, {
appMeta: service(),
SMTPHostEmptyError: empty('model.smtp.host'),
SMTPPortEmptyError: empty('model.smtp.port'),
SMTPSenderEmptyError: empty('model.smtp.sender'),
@ -55,6 +57,8 @@ export default Component.extend(Notifier, {
this.set('buttonText', 'Save & Test');
this.set('testSMTP', result);
this.set('appMeta.configured', true);
if (result.success) {
this.notifySuccess(result.message);
} else {

View file

@ -162,6 +162,14 @@ export default Component.extend(Modals, {
}
this.get('router').transitionTo('customize.billing');
},
onConfigured() {
if (!this.get('session.isAdmin')) {
return;
}
this.get('router').transitionTo('customize.smtp');
}
}
});

View file

@ -34,6 +34,7 @@ export default Service.extend({
allowAnonymousAccess: false,
authProvider: null,
authConfig: null,
configured: true,
setupMode: false,
secureMode: false,
maxTags: 3,

View file

@ -40,7 +40,13 @@
{{#unless appMeta.valid}}
<div class="option invalid-plan" {{action "onBilling"}}>
<i class={{concat "dicon " constants.Icon.Announce}} />
{{#attach-tooltip}}Invalid product plan{{/attach-tooltip}}
{{#attach-tooltip}}Missing activation key{{/attach-tooltip}}
</div>
{{/unless}}
{{#unless appMeta.configured}}
<div class="option invalid-plan" {{action "onConfigured"}}>
<i class={{concat "dicon " constants.Icon.Announce}} />
{{#attach-tooltip}}Missing mail server settings{{/attach-tooltip}}
</div>
{{/unless}}
{{/if}}

View file

@ -44,4 +44,5 @@ type SiteMeta struct {
Storage env.StoreType `json:"storageProvider"`
Location string `json:"location"` // reserved for internal use
Theme string `json:"theme"` // default side-wide theme, user overrideble
Configured bool `json:"configured"` // is Documize instance configured
}