feat: support config use ssl
This commit is contained in:
parent
57e6a398e7
commit
2728eeecf9
|
@ -13,5 +13,7 @@ public class SystemEmailResponse {
|
||||||
|
|
||||||
private Integer smtpPort;
|
private Integer smtpPort;
|
||||||
|
|
||||||
|
private Boolean useSSL;
|
||||||
|
|
||||||
private LocalDateTime createAt;
|
private LocalDateTime createAt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,4 +21,7 @@ public class SystemEmailUpdateRequest {
|
||||||
@Max(65535L)
|
@Max(65535L)
|
||||||
private Integer smtpPort;
|
private Integer smtpPort;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private Boolean useSSL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,7 @@ public class SystemService {
|
||||||
response.setSmtpPort(mail.getSmtpPort());
|
response.setSmtpPort(mail.getSmtpPort());
|
||||||
response.setUsername(mail.getUsername());
|
response.setUsername(mail.getUsername());
|
||||||
response.setCreateAt(mail.getCreateAt());
|
response.setCreateAt(mail.getCreateAt());
|
||||||
|
response.setUseSSL(mail.getUseSsl());
|
||||||
return response;
|
return response;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,11 @@ public class MailSender {
|
||||||
}
|
}
|
||||||
sender.setUsername(properties.getUsername());
|
sender.setUsername(properties.getUsername());
|
||||||
sender.setPassword(properties.getPassword());
|
sender.setPassword(properties.getPassword());
|
||||||
sender.setProtocol("smtp");
|
if (properties.getUseSsl()) {
|
||||||
|
sender.setProtocol("smtps");
|
||||||
|
} else {
|
||||||
|
sender.setProtocol("smtp");
|
||||||
|
}
|
||||||
sender.setDefaultEncoding(StandardCharsets.UTF_8.name());
|
sender.setDefaultEncoding(StandardCharsets.UTF_8.name());
|
||||||
return sender;
|
return sender;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ jooq {
|
||||||
forcedTypes {
|
forcedTypes {
|
||||||
forcedType {
|
forcedType {
|
||||||
name = 'BOOLEAN'
|
name = 'BOOLEAN'
|
||||||
includeExpression = 'deleted|enabled|is.*'
|
includeExpression = 'deleted|enabled|is.*|use_ssl'
|
||||||
includeTypes = '.*'
|
includeTypes = '.*'
|
||||||
}
|
}
|
||||||
forcedType {
|
forcedType {
|
||||||
|
@ -62,7 +62,7 @@ jooq {
|
||||||
}
|
}
|
||||||
forcedType {
|
forcedType {
|
||||||
userType = 'com.databasir.dao.enums.OAuthAppType'
|
userType = 'com.databasir.dao.enums.OAuthAppType'
|
||||||
converter = 'com.databasir.dao.converter.OAuthAppTypeConverter'
|
converter = 'com.databasir.dao.converter.OAuthAppTypeConverter'
|
||||||
includeExpression = 'app_type'
|
includeExpression = 'app_type'
|
||||||
includeTypes = '.*'
|
includeTypes = '.*'
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import org.jooq.ForeignKey;
|
||||||
import org.jooq.Identity;
|
import org.jooq.Identity;
|
||||||
import org.jooq.Name;
|
import org.jooq.Name;
|
||||||
import org.jooq.Record;
|
import org.jooq.Record;
|
||||||
import org.jooq.Row7;
|
import org.jooq.Row8;
|
||||||
import org.jooq.Schema;
|
import org.jooq.Schema;
|
||||||
import org.jooq.Table;
|
import org.jooq.Table;
|
||||||
import org.jooq.TableField;
|
import org.jooq.TableField;
|
||||||
|
@ -72,6 +72,11 @@ public class SysMail extends TableImpl<SysMailRecord> {
|
||||||
*/
|
*/
|
||||||
public final TableField<SysMailRecord, Integer> SMTP_PORT = createField(DSL.name("smtp_port"), SQLDataType.INTEGER.nullable(false), this, "");
|
public final TableField<SysMailRecord, Integer> SMTP_PORT = createField(DSL.name("smtp_port"), SQLDataType.INTEGER.nullable(false), this, "");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column <code>databasir.sys_mail.use_ssl</code>.
|
||||||
|
*/
|
||||||
|
public final TableField<SysMailRecord, Boolean> USE_SSL = createField(DSL.name("use_ssl"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.inline("0", SQLDataType.BOOLEAN)), this, "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The column <code>databasir.sys_mail.update_at</code>.
|
* The column <code>databasir.sys_mail.update_at</code>.
|
||||||
*/
|
*/
|
||||||
|
@ -157,11 +162,11 @@ public class SysMail extends TableImpl<SysMailRecord> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
// Row7 type methods
|
// Row8 type methods
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Row7<Integer, String, String, String, Integer, LocalDateTime, LocalDateTime> fieldsRow() {
|
public Row8<Integer, String, String, String, Integer, Boolean, LocalDateTime, LocalDateTime> fieldsRow() {
|
||||||
return (Row7) super.fieldsRow();
|
return (Row8) super.fieldsRow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ public class SysMailPojo implements Serializable {
|
||||||
private String password;
|
private String password;
|
||||||
private String smtpHost;
|
private String smtpHost;
|
||||||
private Integer smtpPort;
|
private Integer smtpPort;
|
||||||
|
private Boolean useSsl;
|
||||||
private LocalDateTime updateAt;
|
private LocalDateTime updateAt;
|
||||||
private LocalDateTime createAt;
|
private LocalDateTime createAt;
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ public class SysMailPojo implements Serializable {
|
||||||
this.password = value.password;
|
this.password = value.password;
|
||||||
this.smtpHost = value.smtpHost;
|
this.smtpHost = value.smtpHost;
|
||||||
this.smtpPort = value.smtpPort;
|
this.smtpPort = value.smtpPort;
|
||||||
|
this.useSsl = value.useSsl;
|
||||||
this.updateAt = value.updateAt;
|
this.updateAt = value.updateAt;
|
||||||
this.createAt = value.createAt;
|
this.createAt = value.createAt;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +44,7 @@ public class SysMailPojo implements Serializable {
|
||||||
String password,
|
String password,
|
||||||
String smtpHost,
|
String smtpHost,
|
||||||
Integer smtpPort,
|
Integer smtpPort,
|
||||||
|
Boolean useSsl,
|
||||||
LocalDateTime updateAt,
|
LocalDateTime updateAt,
|
||||||
LocalDateTime createAt
|
LocalDateTime createAt
|
||||||
) {
|
) {
|
||||||
|
@ -50,6 +53,7 @@ public class SysMailPojo implements Serializable {
|
||||||
this.password = password;
|
this.password = password;
|
||||||
this.smtpHost = smtpHost;
|
this.smtpHost = smtpHost;
|
||||||
this.smtpPort = smtpPort;
|
this.smtpPort = smtpPort;
|
||||||
|
this.useSsl = useSsl;
|
||||||
this.updateAt = updateAt;
|
this.updateAt = updateAt;
|
||||||
this.createAt = createAt;
|
this.createAt = createAt;
|
||||||
}
|
}
|
||||||
|
@ -124,6 +128,20 @@ public class SysMailPojo implements Serializable {
|
||||||
this.smtpPort = smtpPort;
|
this.smtpPort = smtpPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter for <code>databasir.sys_mail.use_ssl</code>.
|
||||||
|
*/
|
||||||
|
public Boolean getUseSsl() {
|
||||||
|
return this.useSsl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter for <code>databasir.sys_mail.use_ssl</code>.
|
||||||
|
*/
|
||||||
|
public void setUseSsl(Boolean useSsl) {
|
||||||
|
this.useSsl = useSsl;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <code>databasir.sys_mail.update_at</code>.
|
* Getter for <code>databasir.sys_mail.update_at</code>.
|
||||||
*/
|
*/
|
||||||
|
@ -161,6 +179,7 @@ public class SysMailPojo implements Serializable {
|
||||||
sb.append(", ").append(password);
|
sb.append(", ").append(password);
|
||||||
sb.append(", ").append(smtpHost);
|
sb.append(", ").append(smtpHost);
|
||||||
sb.append(", ").append(smtpPort);
|
sb.append(", ").append(smtpPort);
|
||||||
|
sb.append(", ").append(useSsl);
|
||||||
sb.append(", ").append(updateAt);
|
sb.append(", ").append(updateAt);
|
||||||
sb.append(", ").append(createAt);
|
sb.append(", ").append(createAt);
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ import java.time.LocalDateTime;
|
||||||
|
|
||||||
import org.jooq.Field;
|
import org.jooq.Field;
|
||||||
import org.jooq.Record1;
|
import org.jooq.Record1;
|
||||||
import org.jooq.Record7;
|
import org.jooq.Record8;
|
||||||
import org.jooq.Row7;
|
import org.jooq.Row8;
|
||||||
import org.jooq.impl.UpdatableRecordImpl;
|
import org.jooq.impl.UpdatableRecordImpl;
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import org.jooq.impl.UpdatableRecordImpl;
|
||||||
* This class is generated by jOOQ.
|
* This class is generated by jOOQ.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||||
public class SysMailRecord extends UpdatableRecordImpl<SysMailRecord> implements Record7<Integer, String, String, String, Integer, LocalDateTime, LocalDateTime> {
|
public class SysMailRecord extends UpdatableRecordImpl<SysMailRecord> implements Record8<Integer, String, String, String, Integer, Boolean, LocalDateTime, LocalDateTime> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -94,32 +94,46 @@ public class SysMailRecord extends UpdatableRecordImpl<SysMailRecord> implements
|
||||||
return (Integer) get(4);
|
return (Integer) get(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter for <code>databasir.sys_mail.use_ssl</code>.
|
||||||
|
*/
|
||||||
|
public void setUseSsl(Boolean value) {
|
||||||
|
set(5, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter for <code>databasir.sys_mail.use_ssl</code>.
|
||||||
|
*/
|
||||||
|
public Boolean getUseSsl() {
|
||||||
|
return (Boolean) get(5);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for <code>databasir.sys_mail.update_at</code>.
|
* Setter for <code>databasir.sys_mail.update_at</code>.
|
||||||
*/
|
*/
|
||||||
public void setUpdateAt(LocalDateTime value) {
|
public void setUpdateAt(LocalDateTime value) {
|
||||||
set(5, value);
|
set(6, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <code>databasir.sys_mail.update_at</code>.
|
* Getter for <code>databasir.sys_mail.update_at</code>.
|
||||||
*/
|
*/
|
||||||
public LocalDateTime getUpdateAt() {
|
public LocalDateTime getUpdateAt() {
|
||||||
return (LocalDateTime) get(5);
|
return (LocalDateTime) get(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for <code>databasir.sys_mail.create_at</code>.
|
* Setter for <code>databasir.sys_mail.create_at</code>.
|
||||||
*/
|
*/
|
||||||
public void setCreateAt(LocalDateTime value) {
|
public void setCreateAt(LocalDateTime value) {
|
||||||
set(6, value);
|
set(7, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <code>databasir.sys_mail.create_at</code>.
|
* Getter for <code>databasir.sys_mail.create_at</code>.
|
||||||
*/
|
*/
|
||||||
public LocalDateTime getCreateAt() {
|
public LocalDateTime getCreateAt() {
|
||||||
return (LocalDateTime) get(6);
|
return (LocalDateTime) get(7);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
@ -132,17 +146,17 @@ public class SysMailRecord extends UpdatableRecordImpl<SysMailRecord> implements
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
// Record7 type implementation
|
// Record8 type implementation
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Row7<Integer, String, String, String, Integer, LocalDateTime, LocalDateTime> fieldsRow() {
|
public Row8<Integer, String, String, String, Integer, Boolean, LocalDateTime, LocalDateTime> fieldsRow() {
|
||||||
return (Row7) super.fieldsRow();
|
return (Row8) super.fieldsRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Row7<Integer, String, String, String, Integer, LocalDateTime, LocalDateTime> valuesRow() {
|
public Row8<Integer, String, String, String, Integer, Boolean, LocalDateTime, LocalDateTime> valuesRow() {
|
||||||
return (Row7) super.valuesRow();
|
return (Row8) super.valuesRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -171,12 +185,17 @@ public class SysMailRecord extends UpdatableRecordImpl<SysMailRecord> implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Field<LocalDateTime> field6() {
|
public Field<Boolean> field6() {
|
||||||
return SysMail.SYS_MAIL.UPDATE_AT;
|
return SysMail.SYS_MAIL.USE_SSL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Field<LocalDateTime> field7() {
|
public Field<LocalDateTime> field7() {
|
||||||
|
return SysMail.SYS_MAIL.UPDATE_AT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Field<LocalDateTime> field8() {
|
||||||
return SysMail.SYS_MAIL.CREATE_AT;
|
return SysMail.SYS_MAIL.CREATE_AT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,12 +225,17 @@ public class SysMailRecord extends UpdatableRecordImpl<SysMailRecord> implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LocalDateTime component6() {
|
public Boolean component6() {
|
||||||
return getUpdateAt();
|
return getUseSsl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LocalDateTime component7() {
|
public LocalDateTime component7() {
|
||||||
|
return getUpdateAt();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LocalDateTime component8() {
|
||||||
return getCreateAt();
|
return getCreateAt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,12 +265,17 @@ public class SysMailRecord extends UpdatableRecordImpl<SysMailRecord> implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LocalDateTime value6() {
|
public Boolean value6() {
|
||||||
return getUpdateAt();
|
return getUseSsl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LocalDateTime value7() {
|
public LocalDateTime value7() {
|
||||||
|
return getUpdateAt();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LocalDateTime value8() {
|
||||||
return getCreateAt();
|
return getCreateAt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,19 +310,25 @@ public class SysMailRecord extends UpdatableRecordImpl<SysMailRecord> implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SysMailRecord value6(LocalDateTime value) {
|
public SysMailRecord value6(Boolean value) {
|
||||||
setUpdateAt(value);
|
setUseSsl(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SysMailRecord value7(LocalDateTime value) {
|
public SysMailRecord value7(LocalDateTime value) {
|
||||||
|
setUpdateAt(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysMailRecord value8(LocalDateTime value) {
|
||||||
setCreateAt(value);
|
setCreateAt(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SysMailRecord values(Integer value1, String value2, String value3, String value4, Integer value5, LocalDateTime value6, LocalDateTime value7) {
|
public SysMailRecord values(Integer value1, String value2, String value3, String value4, Integer value5, Boolean value6, LocalDateTime value7, LocalDateTime value8) {
|
||||||
value1(value1);
|
value1(value1);
|
||||||
value2(value2);
|
value2(value2);
|
||||||
value3(value3);
|
value3(value3);
|
||||||
|
@ -301,6 +336,7 @@ public class SysMailRecord extends UpdatableRecordImpl<SysMailRecord> implements
|
||||||
value5(value5);
|
value5(value5);
|
||||||
value6(value6);
|
value6(value6);
|
||||||
value7(value7);
|
value7(value7);
|
||||||
|
value8(value8);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +354,7 @@ public class SysMailRecord extends UpdatableRecordImpl<SysMailRecord> implements
|
||||||
/**
|
/**
|
||||||
* Create a detached, initialised SysMailRecord
|
* Create a detached, initialised SysMailRecord
|
||||||
*/
|
*/
|
||||||
public SysMailRecord(Integer id, String username, String password, String smtpHost, Integer smtpPort, LocalDateTime updateAt, LocalDateTime createAt) {
|
public SysMailRecord(Integer id, String username, String password, String smtpHost, Integer smtpPort, Boolean useSsl, LocalDateTime updateAt, LocalDateTime createAt) {
|
||||||
super(SysMail.SYS_MAIL);
|
super(SysMail.SYS_MAIL);
|
||||||
|
|
||||||
setId(id);
|
setId(id);
|
||||||
|
@ -326,6 +362,7 @@ public class SysMailRecord extends UpdatableRecordImpl<SysMailRecord> implements
|
||||||
setPassword(password);
|
setPassword(password);
|
||||||
setSmtpHost(smtpHost);
|
setSmtpHost(smtpHost);
|
||||||
setSmtpPort(smtpPort);
|
setSmtpPort(smtpPort);
|
||||||
|
setUseSsl(useSsl);
|
||||||
setUpdateAt(updateAt);
|
setUpdateAt(updateAt);
|
||||||
setCreateAt(createAt);
|
setCreateAt(createAt);
|
||||||
}
|
}
|
||||||
|
@ -342,6 +379,7 @@ public class SysMailRecord extends UpdatableRecordImpl<SysMailRecord> implements
|
||||||
setPassword(value.getPassword());
|
setPassword(value.getPassword());
|
||||||
setSmtpHost(value.getSmtpHost());
|
setSmtpHost(value.getSmtpHost());
|
||||||
setSmtpPort(value.getSmtpPort());
|
setSmtpPort(value.getSmtpPort());
|
||||||
|
setUseSsl(value.getUseSsl());
|
||||||
setUpdateAt(value.getUpdateAt());
|
setUpdateAt(value.getUpdateAt());
|
||||||
setCreateAt(value.getCreateAt());
|
setCreateAt(value.getCreateAt());
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ CREATE TABLE IF NOT EXISTS sys_mail
|
||||||
password TEXT NOT NULL,
|
password TEXT NOT NULL,
|
||||||
smtp_host VARCHAR(512) NOT NULL,
|
smtp_host VARCHAR(512) NOT NULL,
|
||||||
smtp_port INT NOT NULL,
|
smtp_port INT NOT NULL,
|
||||||
|
use_ssl BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||||
) CHARSET utf8mb4
|
) CHARSET utf8mb4
|
||||||
|
|
Loading…
Reference in New Issue