Browse Source

Add prefix to every properties for grouping them

pull/340/head
seamys 7 years ago
parent
commit
807138266b
  1. 36
      extensions/Squidex.Extensions/Actions/Email/EmailAction.cs
  2. 48
      extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs
  3. 1
      src/Squidex/AppServices.cs
  4. 56
      src/Squidex/app/features/rules/pages/rules/actions/email-action.component.html
  5. 36
      src/Squidex/app/features/rules/pages/rules/actions/email-action.component.ts
  6. 12
      src/Squidex/appsettings.json

36
extensions/Squidex.Extensions/Actions/Email/EmailAction.cs

@ -20,39 +20,39 @@ namespace Squidex.Extensions.Actions.Email
public class EmailAction : RuleAction
{
[Required]
[Display(Name = "Host", Description = "The Name or IP address of the host used for SMTP transactions.")]
public string Host { get; set; }
[Display(Name = "ServerHost", Description = "The Name or IP address of the host used for SMTP transactions.")]
public string ServerHost { get; set; }
[Required]
[Display(Name = "Port", Description = "The port to be used on host.")]
public int Port { get; set; }
[Display(Name = "ServerPort", Description = "The port to be used on host.")]
public int ServerPort { get; set; }
[Required]
[Display(Name = "EnableSsl", Description = "Specify whether the smtp client uses Secure Sockets Layer (SSL) to encrypt the connection.")]
public bool EnableSsl { get; set; }
[Display(Name = "ServerUseSsl", Description = "Specify whether the smtp client uses Secure Sockets Layer (SSL) to encrypt the connection.")]
public bool ServerUseSsl { get; set; }
[Required]
[Display(Name = "Username", Description = "The username used to authenticate the sender.")]
public string Username { get; set; }
[Display(Name = "ServerUsername", Description = "The username used to authenticate the sender.")]
public string ServerUsername { get; set; }
[Required]
[Display(Name = "Password", Description = "The password used to authenticate the sender.")]
public string Password { get; set; }
[Display(Name = "ServerPassword", Description = "The password used to authenticate the sender.")]
public string ServerPassword { get; set; }
[Required]
[Display(Name = "From", Description = "The email is sent from?")]
public string From { get; set; }
[Display(Name = "MessageFrom", Description = "The email sending address.")]
public string MessageFrom { get; set; }
[Required]
[Display(Name = "To", Description = "The email will be sent to?")]
public string To { get; set; }
[Display(Name = "MessageTo", Description = "The email message will be sent to.")]
public string MessageTo { get; set; }
[Required]
[Display(Name = "Subject", Description = "The subject line for this e-mail message.")]
public string Subject { get; set; }
[Display(Name = "MessageSubject", Description = "The subject line for this email message.")]
public string MessageSubject { get; set; }
[Required]
[Display(Name = "Body", Description = "The message body.")]
public string Body { get; set; }
[Display(Name = "MessageBody", Description = "The message body.")]
public string MessageBody { get; set; }
}
}

48
extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs

@ -31,15 +31,15 @@ namespace Squidex.Extensions.Actions.Email
{
var ruleJob = new EmailJob
{
Host = action.Host,
EnableSsl = action.EnableSsl,
Password = action.Password,
Port = action.Port,
Username = Format(action.Username, @event),
From = Format(action.From, @event),
To = Format(action.To, @event),
Subject = Format(action.Subject, @event),
Body = Format(action.Body, @event)
ServerHost = action.ServerHost,
ServerUseSsl = action.ServerUseSsl,
ServerPassword = action.ServerPassword,
ServerPort = action.ServerPort,
ServerUsername = Format(action.ServerUsername, @event),
MessageFrom = Format(action.MessageFrom, @event),
MessageTo = Format(action.MessageTo, @event),
MessageSubject = Format(action.MessageSubject, @event),
MessageBody = Format(action.MessageBody, @event)
};
return (Description, ruleJob);
@ -47,15 +47,15 @@ namespace Squidex.Extensions.Actions.Email
protected override async Task<(string Dump, Exception Exception)> ExecuteJobAsync(EmailJob job)
{
using (var client = new SmtpClient(job.Host, job.Port))
using (var client = new SmtpClient(job.ServerHost, job.ServerPort))
{
client.EnableSsl = job.EnableSsl;
client.Credentials = new NetworkCredential(job.Username, job.Password);
client.EnableSsl = job.ServerUseSsl;
client.Credentials = new NetworkCredential(job.ServerUsername, job.ServerPassword);
using (var message = new MailMessage(job.From, job.To))
using (var message = new MailMessage(job.MessageFrom, job.MessageTo))
{
message.Subject = job.Subject;
message.Body = job.Body;
message.Subject = job.MessageSubject;
message.Body = job.MessageBody;
await client.SendMailAsync(message);
}
}
@ -66,22 +66,22 @@ namespace Squidex.Extensions.Actions.Email
public class EmailJob
{
public string Host { get; set; }
public string ServerHost { get; set; }
public int Port { get; set; }
public int ServerPort { get; set; }
public string Username { get; set; }
public string ServerUsername { get; set; }
public string Password { get; set; }
public string ServerPassword { get; set; }
public bool EnableSsl { get; set; }
public bool ServerUseSsl { get; set; }
public string From { get; set; }
public string MessageFrom { get; set; }
public string To { get; set; }
public string MessageTo { get; set; }
public string Subject { get; set; }
public string MessageSubject { get; set; }
public string Body { get; set; }
public string MessageBody { get; set; }
}
}

1
src/Squidex/AppServices.cs

@ -16,7 +16,6 @@ using Squidex.Config.Domain;
using Squidex.Config.Web;
using Squidex.Domain.Apps.Entities.Assets;
using Squidex.Domain.Apps.Entities.Contents;
using Squidex.Extensions.Actions.Email;
using Squidex.Extensions.Actions.Twitter;
using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Diagnostics;

56
src/Squidex/app/features/rules/pages/rules/actions/email-action.component.html

@ -1,11 +1,11 @@
<div [formGroup]="actionForm" class="form-horizontal">
<div class="form-group row">
<label class="col-3 col-form-label" for="host">Host</label>
<label class="col-3 col-form-label" for="serverHost">ServerHost</label>
<div class="col-9">
<sqx-control-errors for="from" [submitted]="actionFormSubmitted"></sqx-control-errors>
<input type="text" class="form-control" id="host" formControlName="host" />
<input type="text" class="form-control" id="serverHost" formControlName="serverHost" />
<small class="form-text text-muted">
The Name or IP address of the host used for SMTP transactions.
@ -14,12 +14,12 @@
</div>
<div class="form-group row">
<label class="col-3 col-form-label" for="port">Port</label>
<label class="col-3 col-form-label" for="serverPort">ServerPort</label>
<div class="col-9">
<sqx-control-errors for="port" [submitted]="actionFormSubmitted"></sqx-control-errors>
<sqx-control-errors for="serverPort" [submitted]="actionFormSubmitted"></sqx-control-errors>
<input type="text" class="form-control" id="port" formControlName="port" />
<input type="text" class="form-control" id="serverPort" formControlName="serverPort" />
<small class="form-text text-muted">
The port to be used on host.
@ -30,9 +30,9 @@
<div class="form-group row">
<div class="col-9 offset-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="enableSsl" formControlName="enableSsl" />
<label class="form-check-label" for="enableSsl">
EnableSsl
<input class="form-check-input" type="checkbox" id="serverUseSsl" formControlName="serverUseSsl" />
<label class="form-check-label" for="serverUseSsl">
ServerUseSsl
</label>
</div>
<small class="form-text text-muted">
@ -42,26 +42,26 @@
</div>
<div class="form-group row">
<label class="col-3 col-form-label" for="username">Username</label>
<label class="col-3 col-form-label" for="serverUsername">ServerUsername</label>
<div class="col-9">
<sqx-control-errors for="port" [submitted]="actionFormSubmitted"></sqx-control-errors>
<sqx-control-errors for="serverUsername" [submitted]="actionFormSubmitted"></sqx-control-errors>
<input type="text" class="form-control" id="username" formControlName="username" />
<input type="text" class="form-control" id="serverUsername" formControlName="serverUsername" />
<small class="form-text text-muted">
The username used to authenticate the sender.
The username used to authenticate the sender. Read the <a routerLink="help">help</a> section for information about advanced formatting.
</small>
</div>
</div>
<div class="form-group row">
<label class="col-3 col-form-label" for="password">Password</label>
<label class="col-3 col-form-label" for="serverPassword">ServerPassword</label>
<div class="col-9">
<sqx-control-errors for="password" [submitted]="actionFormSubmitted"></sqx-control-errors>
<input type="password" class="form-control" id="password" formControlName="password" />
<input type="password" class="form-control" id="serverPassword" formControlName="serverPassword" />
<small class="form-text text-muted">
The password used to authenticate the sender.
@ -70,58 +70,58 @@
</div>
<div class="form-group row">
<label class="col-3 col-form-label" for="from">From</label>
<label class="col-3 col-form-label" for="messageFrom">MessageFrom</label>
<div class="col-9">
<sqx-control-errors for="from" [submitted]="actionFormSubmitted"></sqx-control-errors>
<sqx-control-errors for="messageFrom" [submitted]="actionFormSubmitted"></sqx-control-errors>
<input type="text" class="form-control" id="from" formControlName="from" />
<input type="text" class="form-control" id="messageFrom" formControlName="messageFrom" />
<small class="form-text text-muted">
The email is sent from?
The email sending address. Read the <a routerLink="help">help</a> section for information about advanced formatting.
</small>
</div>
</div>
<div class="form-group row">
<label class="col-3 col-form-label" for="to">To</label>
<label class="col-3 col-form-label" for="messageTo">MessageTo</label>
<div class="col-9">
<sqx-control-errors for="to" [submitted]="actionFormSubmitted"></sqx-control-errors>
<sqx-control-errors for="messageTo" [submitted]="actionFormSubmitted"></sqx-control-errors>
<input type="text" class="form-control" id="to" formControlName="to" />
<input type="text" class="form-control" id="messageTo" formControlName="messageTo" />
<small class="form-text text-muted">
The email will be sent to?
The email message will be sent to. Read the <a routerLink="help">help</a> section for information about advanced formatting.
</small>
</div>
</div>
<div class="form-group row">
<label class="col-3 col-form-label" for="subject">Subject</label>
<label class="col-3 col-form-label" for="messageSubject">MessageSubject</label>
<div class="col-9">
<sqx-control-errors for="subject" [submitted]="actionFormSubmitted"></sqx-control-errors>
<input type="text" class="form-control" id="subject" formControlName="subject" />
<input type="text" class="form-control" id="messageSubject" formControlName="messageSubject" />
<small class="form-text text-muted">
The subject line for this e-mail message.
The subject line for this email message. Read the <a routerLink="help">help</a> section for information about advanced formatting.
</small>
</div>
</div>
<div class="form-group row">
<label class="col-3 col-form-label" for="body">Body</label>
<label class="col-3 col-form-label" for="messageBody">MessageBody</label>
<div class="col-9">
<sqx-control-errors for="body" [submitted]="actionFormSubmitted"></sqx-control-errors>
<textarea class="form-control" id="body" formControlName="body"></textarea>
<textarea class="form-control" id="messageBody" formControlName="messageBody"></textarea>
<small class="form-text text-muted">
The message body
The message body. Read the <a routerLink="help">help</a> section for information about advanced formatting.
</small>
</div>
</div>

36
src/Squidex/app/features/rules/pages/rules/actions/email-action.component.ts

@ -24,47 +24,47 @@ export class EmailActionComponent implements OnInit {
public actionFormSubmitted = false;
public ngOnInit() {
this.actionForm.setControl('host',
new FormControl(this.action.host || 'smtp.gmail.com', [
this.actionForm.setControl('serverHost',
new FormControl(this.action.serverHost || 'smtp.gmail.com', [
Validators.required
]));
this.actionForm.setControl('port',
new FormControl(this.action.port || 465, [
this.actionForm.setControl('serverPort',
new FormControl(this.action.serverPort || 465, [
Validators.required,
Validators.pattern(/\d{2,6}/)
]));
this.actionForm.setControl('enableSsl',
new FormControl(this.action.enableSsl || true));
this.actionForm.setControl('serverUseSsl',
new FormControl(this.action.serverUseSsl || true));
this.actionForm.setControl('username',
new FormControl(this.action.username || '', [
this.actionForm.setControl('serverUsername',
new FormControl(this.action.serverUsername || '', [
Validators.required
]));
this.actionForm.setControl('password',
new FormControl(this.action.password || '', [
this.actionForm.setControl('serverPassword',
new FormControl(this.action.serverPassword || '', [
Validators.required
]));
this.actionForm.setControl('from',
new FormControl(this.action.from || '', [
this.actionForm.setControl('messageFrom',
new FormControl(this.action.messageFrom || '', [
Validators.required
]));
this.actionForm.setControl('to',
new FormControl(this.action.to || '', [
this.actionForm.setControl('messageTo',
new FormControl(this.action.messageTo || '', [
Validators.required
]));
this.actionForm.setControl('subject',
new FormControl(this.action.subject || '', [
this.actionForm.setControl('messageSubject',
new FormControl(this.action.messageSubject || '', [
Validators.required
]));
this.actionForm.setControl('body',
new FormControl(this.action.body || '', [
this.actionForm.setControl('messageBody',
new FormControl(this.action.messageBody || '', [
Validators.required
]));
}

12
src/Squidex/appsettings.json

@ -68,8 +68,8 @@
/*
* The maximum number of megabyte that the process can consume until it is marked as not healthy.
*/
"threshold": 4096
}
"threshold": 4096
}
},
"contentsController": {
@ -78,13 +78,13 @@
*
* Nginx Has problems with long headers. It might make sense to disable this feature if you do not use a CDN.
*/
"enableSurrogateKeys": true,
"enableSurrogateKeys": true,
/*
/*
* Restrict the surrogate keys to results that have less than 200 items.
*/
"maxItemsForSurrogateKeys": 200
},
"maxItemsForSurrogateKeys": 200
},
"content": {
/*

Loading…
Cancel
Save