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/auth"
"github.com/documize/community/domain/organization" "github.com/documize/community/domain/organization"
indexer "github.com/documize/community/domain/search" indexer "github.com/documize/community/domain/search"
"github.com/documize/community/domain/setting"
"github.com/documize/community/domain/store" "github.com/documize/community/domain/store"
"github.com/documize/community/model/doc" "github.com/documize/community/model/doc"
"github.com/documize/community/model/org" "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.Storage = h.Runtime.StoreProvider.Type()
data.Location = h.Runtime.Flags.Location // reserved 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 // Strip secrets
data.AuthConfig = auth.StripAuthSecrets(h.Runtime, org.AuthProvider, org.AuthConfig) 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{} var y map[string]interface{}
json.Unmarshal([]byte(config), &y) json.Unmarshal([]byte(config), &y)
j, err := json.Marshal(y) j, err := json.Marshal(y)
if err != nil { if err != nil {
response.WriteBadRequestError(w, method, err.Error()) response.WriteBadRequestError(w, method, err.Error())

View file

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

View file

@ -162,6 +162,14 @@ export default Component.extend(Modals, {
} }
this.get('router').transitionTo('customize.billing'); 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, allowAnonymousAccess: false,
authProvider: null, authProvider: null,
authConfig: null, authConfig: null,
configured: true,
setupMode: false, setupMode: false,
secureMode: false, secureMode: false,
maxTags: 3, maxTags: 3,

View file

@ -40,7 +40,13 @@
{{#unless appMeta.valid}} {{#unless appMeta.valid}}
<div class="option invalid-plan" {{action "onBilling"}}> <div class="option invalid-plan" {{action "onBilling"}}>
<i class={{concat "dicon " constants.Icon.Announce}} /> <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> </div>
{{/unless}} {{/unless}}
{{/if}} {{/if}}

View file

@ -42,6 +42,7 @@ type SiteMeta struct {
Edition domain.Edition `json:"edition"` Edition domain.Edition `json:"edition"`
ConversionEndpoint string `json:"conversionEndpoint"` ConversionEndpoint string `json:"conversionEndpoint"`
Storage env.StoreType `json:"storageProvider"` Storage env.StoreType `json:"storageProvider"`
Location string `json:"location"` // reserved for internal use Location string `json:"location"` // reserved for internal use
Theme string `json:"theme"` // default side-wide theme, user overrideble Theme string `json:"theme"` // default side-wide theme, user overrideble
Configured bool `json:"configured"` // is Documize instance configured
} }