mirror of
https://github.com/documize/community.git
synced 2025-08-02 20:15:26 +02:00
New SMTP library and refactoring of mailer code
This commit is contained in:
parent
99220641f3
commit
bd43319bb2
39 changed files with 3163 additions and 1268 deletions
|
@ -17,8 +17,10 @@ export default Component.extend({
|
|||
SMTPHostEmptyError: empty('model.smtp.host'),
|
||||
SMTPPortEmptyError: empty('model.smtp.port'),
|
||||
SMTPSenderEmptyError: empty('model.smtp.sender'),
|
||||
SMTPUserIdEmptyError: empty('model.smtp.userid'),
|
||||
SMTPPasswordEmptyError: empty('model.smtp.password'),
|
||||
senderNameError: empty('model.smtp.senderName'),
|
||||
|
||||
buttonText: 'Save & Test',
|
||||
testSMTP: null,
|
||||
|
||||
actions: {
|
||||
saveSMTP() {
|
||||
|
@ -34,16 +36,22 @@ export default Component.extend({
|
|||
$("#smtp-sender").focus();
|
||||
return;
|
||||
}
|
||||
if (this.get('SMTPUserIdEmptyError')) {
|
||||
$("#smtp-userid").focus();
|
||||
return;
|
||||
}
|
||||
if (this.get('SMTPPasswordEmptyError')) {
|
||||
$("#smtp-password").focus();
|
||||
if (this.get('senderNameError')) {
|
||||
$("#smtp-senderName").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
this.get('saveSMTP')().then(() => {
|
||||
this.set('testSMTP', {
|
||||
success: true,
|
||||
message: ''
|
||||
},
|
||||
);
|
||||
|
||||
this.set('buttonText', 'Please wait...');
|
||||
|
||||
this.get('saveSMTP')().then((result) => {
|
||||
this.set('buttonText', 'Save & Test');
|
||||
this.set('testSMTP', result);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,8 @@ export default Controller.extend({
|
|||
actions: {
|
||||
saveSMTP() {
|
||||
if(this.get('session.isGlobalAdmin')) {
|
||||
return this.get('global').saveSMTPConfig(this.model.smtp).then(() => {
|
||||
return this.get('global').saveSMTPConfig(this.model.smtp).then((response) => {
|
||||
return response;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,4 +124,16 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
> .smtp-failure {
|
||||
font-size: 1.2rem;
|
||||
font-weight: bold;
|
||||
color: $color-red;
|
||||
}
|
||||
|
||||
> .smtp-success {
|
||||
font-size: 1.2rem;
|
||||
font-weight: bold;
|
||||
color: $color-green;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,40 +10,82 @@
|
|||
<div class="view-customize">
|
||||
<form class="mt-5">
|
||||
<div class="form-group row">
|
||||
<label for="smtp-host" class="col-sm-2 col-form-label">Host</label>
|
||||
<div class="col-sm-10">
|
||||
<label for="smtp-host" class="col-sm-4 col-form-label">Host</label>
|
||||
<div class="col-sm-8">
|
||||
{{focus-input id="smtp-host" type="text" value=model.smtp.host class=(if SMTPHostEmptyError 'form-control is-invalid' 'form-control')}}
|
||||
<small class="form-text text-muted">e.g. my.host.com</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="smtp-port" class="col-sm-2 col-form-label">Port</label>
|
||||
<div class="col-sm-10">
|
||||
<label for="smtp-port" class="col-sm-4 col-form-label">Port</label>
|
||||
<div class="col-sm-8">
|
||||
{{input id="smtp-port" type="text" value=model.smtp.port class=(if SMTPPortEmptyError 'form-control is-invalid' 'form-control')}}
|
||||
<small class="form-text text-muted">e.g. 587</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="smtp-sender" class="col-sm-2 col-form-label">Sender</label>
|
||||
<div class="col-sm-10">
|
||||
{{input id="smtp-sender" type="text" value=model.smtp.sender class=(if SMTPSenderEmptyError 'form-control is-invalid' 'form-control')}}
|
||||
<small class="form-text text-muted">e.g. user@some-domain.com</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="smtp-userid" class="col-sm-2 col-form-label">Username</label>
|
||||
<div class="col-sm-10">
|
||||
{{input id="smtp-userid" type="text" value=model.smtp.userid class=(if SMTPUserIdEmptyError 'form-control is-invalid' 'form-control')}}
|
||||
<label for="smtp-userid" class="col-sm-4 col-form-label">Username</label>
|
||||
<div class="col-sm-8">
|
||||
{{input id="smtp-userid" type="text" value=model.smtp.userid class='form-control'}}
|
||||
<small class="form-text text-muted">e.g. Login username for SMTP server</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="smtp-password" class="col-sm-2 col-form-label">Password</label>
|
||||
<div class="col-sm-10">
|
||||
{{input id="smtp-password" type="password" value=model.smtp.password class=(if SMTPPasswordEmptyError 'form-control is-invalid' 'form-control')}}
|
||||
<label for="smtp-password" class="col-sm-4 col-form-label">Password</label>
|
||||
<div class="col-sm-8">
|
||||
{{input id="smtp-password" type="password" value=model.smtp.password class='form-control'}}
|
||||
<small class="form-text text-muted">e.g. Login password for SMTP server</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn btn-success mt-4" {{action 'saveSMTP'}}>Save</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="smtp-sender" class="col-sm-4 col-form-label">Sender Email</label>
|
||||
<div class="col-sm-8">
|
||||
{{input id="smtp-sender" type="email" value=model.smtp.sender class=(if SMTPSenderEmptyError 'form-control is-invalid' 'form-control')}}
|
||||
<small class="form-text text-muted">e.g. user@some-domain.com</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="smtp-senderName" class="col-sm-4 col-form-label">Sender Name</label>
|
||||
<div class="col-sm-8">
|
||||
{{input id="smtp-senderName" type="text" value=model.smtp.senderName class=(if senderNameError 'form-control is-invalid' 'form-control')}}
|
||||
<small class="form-text text-muted">e.g. Documize</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label">Anonymous</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="form-check">
|
||||
{{input id="smtp-anonymous" type="checkbox" checked=model.smtp.anonymous class='form-check-input'}}
|
||||
<label class="form-check-label" for="smtp-anonymous">Anonymous authentication, ignore Username and Password fields</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label">Base64</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="form-check">
|
||||
{{input id="smtp-base64creds" type="checkbox" checked=model.smtp.base64creds class='form-check-input'}}
|
||||
<label class="form-check-label" for="smtp-base64creds">Base64 encode Username and Password fields</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label">SSL</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="form-check">
|
||||
{{input id="smtp-usessl" type="checkbox" checked=model.smtp.usessl class='form-check-input'}}
|
||||
<label class="form-check-label" for="smtp-usessl">Use SSL</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn btn-success mt-4" {{action 'saveSMTP'}}>{{buttonText}}</div>
|
||||
</form>
|
||||
{{#if testSMTP.success}}
|
||||
<p class="smtp-success my-3">{{testSMTP.message}}</p>
|
||||
{{else}}
|
||||
<p class="smtp-failure my-3">{{testSMTP.message}}</p>
|
||||
{{/if}}
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue