-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into module-layers-issue
- Loading branch information
Showing
16 changed files
with
208 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...oder-domain/src/main/java/org/lowcoder/domain/user/service/EmailCommunicationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.lowcoder.domain.user.service; | ||
|
||
import jakarta.mail.internet.MimeMessage; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.lowcoder.sdk.config.CommonConfig; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.mail.javamail.JavaMailSender; | ||
import org.springframework.mail.javamail.MimeMessageHelper; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@Slf4j(topic = "EmailCommunicationService") | ||
public class EmailCommunicationService { | ||
|
||
@Autowired | ||
private JavaMailSender javaMailSender; | ||
|
||
@Autowired | ||
private CommonConfig config; | ||
|
||
public boolean sendPasswordResetEmail(String to, String token, String message) { | ||
try { | ||
String subject = "Reset Your Lost Password"; | ||
MimeMessage mimeMessage = javaMailSender.createMimeMessage(); | ||
|
||
MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, true); | ||
|
||
mimeMessageHelper.setFrom(config.getLostPasswordEmailSender()); | ||
mimeMessageHelper.setTo(to); | ||
mimeMessageHelper.setSubject(subject); | ||
|
||
// Construct the message with the token link | ||
String resetLink = config.getLowcoderPublicUrl() + "/lost-password?token=" + token; | ||
String formattedMessage = String.format(message, to, resetLink); | ||
mimeMessageHelper.setText(formattedMessage, true); // Set HTML to true to allow links | ||
|
||
javaMailSender.send(mimeMessage); | ||
|
||
return true; | ||
|
||
} catch (Exception e) { | ||
log.error("Failed to send mail to: {}, Exception: ", to, e); | ||
return false; | ||
} | ||
|
||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,22 @@ spring: | |
main: | ||
allow-bean-definition-overriding: true | ||
allow-circular-references: true | ||
mail: | ||
host: smtp.gmail.com | ||
port: 587 | ||
username: [email protected] | ||
password: yourpass | ||
properties: | ||
mail: | ||
smtp: | ||
auth: true | ||
ssl: | ||
enable: false | ||
starttls: | ||
enable: true | ||
required: true | ||
transport: | ||
protocol: smtp | ||
|
||
logging: | ||
level: | ||
|
@@ -58,6 +74,8 @@ common: | |
password: Password@123 | ||
marketplace: | ||
private-mode: false | ||
lowcoder-public-url: http://localhost:8080 | ||
notifications-email-sender: [email protected] | ||
|
||
material: | ||
mongodb-grid-fs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,22 @@ spring: | |
max-in-memory-size: 20MB | ||
webflux: | ||
base-path: / | ||
|
||
mail: | ||
host: ${LOWCODER_ADMIN_SMTP_HOST:smtp.gmail.com} | ||
port: ${LOWCODER_ADMIN_SMTP_PORT:587} | ||
username: ${LOWCODER_ADMIN_SMTP_USERNAME:[email protected]} | ||
password: ${LOWCODER_ADMIN_SMTP_PASSWORD:yourpass} | ||
properties: | ||
mail: | ||
smtp: | ||
auth: ${LOWCODER_ADMIN_SMTP_AUTH:true} | ||
ssl: | ||
enable: ${LOWCODER_ADMIN_SMTP_SSL_ENABLED:false} | ||
starttls: | ||
enable: ${LOWCODER_ADMIN_SMTP_STARTTLS_ENABLED:true} | ||
required: ${LOWCODER_ADMIN_SMTP_STARTTLS_REQUIRED:true} | ||
transport: | ||
protocol: smtp | ||
server: | ||
compression: | ||
enabled: true | ||
|
@@ -57,6 +72,8 @@ common: | |
- ${LOWCODER_PLUGINS_DIR:plugins} | ||
marketplace: | ||
private-mode: ${LOWCODER_MARKETPLACE_PRIVATE_MODE:true} | ||
lowcoder-public-url: ${LOWCODER_PUBLIC_URL:http://localhost:8080} | ||
notifications-email-sender: ${LOWCODER_LOST_PASSWORD_EMAIL_SENDER:[email protected]} | ||
|
||
material: | ||
mongodb-grid-fs: | ||
|