Skip to content

Commit 495a4d6

Browse files
authored
Merge pull request #80 from databucket/3.4.0
v.3.4.1
2 parents 489f33f + 5b8fd45 commit 495a4d6

10 files changed

Lines changed: 38 additions & 19 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
group = 'pl.databucket'
9-
version = '3.4.0'
9+
version = '3.4.1'
1010
targetCompatibility = 8
1111
sourceCompatibility = 8
1212

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"homepage": ".",
33
"name": "databucket",
4-
"version": "3.4.0",
4+
"version": "3.4.1",
55
"private": true,
66
"dependencies": {
77
"@material-ui/core": "4.12.4",

frontend/src/components/dialogs/InfoDialog.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default function InfoDialog() {
6262
>
6363
<img style={{marginLeft: '100px', marginTop: '20px'}} src={DatabucketLogo} alt='' width='399' height='65'/>
6464
<div style={{margin: '20px'}}>
65-
<Typography color='secondary'>Version: <b>3.4.0</b></Typography>
65+
<Typography color='secondary'>Version: <b>3.4.1</b></Typography>
6666
<Link target='_blank' href='https://www.databucket.pl' color="primary">www.databucket.pl</Link><br/>
6767
<Link target='_blank' href='https://github.com/databucket/databucket-server' color="textSecondary">Source code</Link><br/>
6868
<Link target='_blank' href='https://github.com/databucket/databucket-server/wiki' color="textSecondary">Documentation</Link><br/>

frontend/src/components/login/LoginPage.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ export default function LoginPage() {
291291
<div className="ContainerClass">
292292
{<img src={Logo} alt=''/>}
293293
{paper()}
294-
<Typography variant="caption">3.4.0</Typography>
294+
<Typography variant="caption">3.4.1</Typography>
295295
<MessageBox
296296
config={messageBox}
297297
onClose={() => setMessageBox({...messageBox, open: false})}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package pl.databucket.server.configuration;
2+
3+
import lombok.Getter;
4+
import org.springframework.beans.factory.annotation.Value;
5+
import org.springframework.stereotype.Component;
6+
7+
@Component
8+
@Getter
9+
public class AppProperties {
10+
11+
@Value("${spring.mail.from}")
12+
private String from;
13+
14+
}

src/main/java/pl/databucket/server/configuration/SwaggerConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public Docket confDataContext() {
4949
private ApiInfo apiInfo() {
5050
return new ApiInfoBuilder()
5151
.title("Databucket API")
52-
.version("3.4.0")
52+
.version("3.4.1")
5353
.build();
5454
}
5555
}

src/main/java/pl/databucket/server/service/ManageUserService.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import org.springframework.security.core.userdetails.UsernameNotFoundException;
66
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
77
import org.springframework.stereotype.Service;
8+
import pl.databucket.server.configuration.AppProperties;
89
import pl.databucket.server.configuration.Constants;
910
import pl.databucket.server.dto.AuthReqDTO;
1011
import pl.databucket.server.dto.ForgotPasswordReqDTO;
@@ -22,7 +23,6 @@
2223
import pl.databucket.server.security.TokenProvider;
2324
import pl.databucket.server.service.mail.MailSenderService;
2425

25-
import javax.mail.AuthenticationFailedException;
2626
import javax.mail.MessagingException;
2727
import java.time.Instant;
2828
import java.time.temporal.ChronoUnit;
@@ -50,6 +50,8 @@ public class ManageUserService {
5050
@Autowired
5151
private MailSenderService mailSenderService;
5252

53+
@Autowired
54+
private AppProperties appProperties;
5355

5456
public List<User> getUsers() {
5557
return userRepository.findAllByOrderById();
@@ -90,7 +92,7 @@ public void signUpUser(SignUpDtoRequest signUpDtoRequest) throws MessagingExcept
9092
newUser.setRoles(roles);
9193
newUser = userRepository.save(newUser);
9294

93-
mailSenderService.sendConfirmationLink(newUser, signUpDtoRequest.getUrl() + jwtTokenUtil.packToJwts(signUpDtoRequest.getEmail()));
95+
mailSenderService.sendConfirmationLink(newUser, signUpDtoRequest.getUrl() + jwtTokenUtil.packToJwts(signUpDtoRequest.getEmail()), appProperties.getFrom());
9496
}
9597

9698
public void signUpUserConfirmation(String jwts) throws ForbiddenRepetitionException, MessagingException {
@@ -104,7 +106,7 @@ public void signUpUserConfirmation(String jwts) throws ForbiddenRepetitionExcept
104106
user.setEnabled(true);
105107
userRepository.save(user);
106108

107-
mailSenderService.sendRegistrationConfirmation(user);
109+
mailSenderService.sendRegistrationConfirmation(user, appProperties.getFrom());
108110
} else
109111
throw new AccountExpiredException("The confirmation link is expired!");
110112
}
@@ -123,7 +125,7 @@ public void forgotPasswordMessage(ForgotPasswordReqDTO forgotPasswordReqDTO) thr
123125
throw new ForbiddenRepetitionException("The confirmation link has been send within last 48 hours. Search it in your email inbox.");
124126
}
125127

126-
mailSenderService.sendForgotPasswordLink(user, forgotPasswordReqDTO.getUrl() + jwtTokenUtil.packToJwts(forgotPasswordReqDTO.getEmail()));
128+
mailSenderService.sendForgotPasswordLink(user, forgotPasswordReqDTO.getUrl() + jwtTokenUtil.packToJwts(forgotPasswordReqDTO.getEmail()), appProperties.getFrom());
127129
user.setLastSendEmailForgotPasswordLinkDate(new Date());
128130
userRepository.save(user);
129131
}
@@ -183,7 +185,7 @@ public void resetAndSendPassword(String jwts) throws ForbiddenRepetitionExceptio
183185

184186
String newPassword = new String(password);
185187

186-
mailSenderService.sendNewPassword(user, newPassword);
188+
mailSenderService.sendNewPassword(user, newPassword, appProperties.getFrom());
187189

188190
user.setPassword(bcryptEncoder.encode(newPassword));
189191
user.setChangePassword(true);

src/main/java/pl/databucket/server/service/mail/MailSenderService.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package pl.databucket.server.service.mail;
22

3-
import com.sun.mail.util.MailConnectException;
43
import lombok.AllArgsConstructor;
5-
import org.springframework.mail.MailSendException;
64
import org.springframework.mail.javamail.JavaMailSender;
75
import org.springframework.stereotype.Service;
86
import pl.databucket.server.entity.User;
@@ -15,7 +13,7 @@ public class MailSenderService {
1513

1614
private JavaMailSender sender;
1715

18-
public void sendConfirmationLink(User user, String link) throws MessagingException {
16+
public void sendConfirmationLink(User user, String link, String from) throws MessagingException {
1917
String htmlContent = "<h2>Thanks for signing up to Databucket.</h2>";
2018

2119
htmlContent += "<p>To confirm your registration, copy and paste the URL into your browser:</p>";
@@ -25,26 +23,28 @@ public void sendConfirmationLink(User user, String link) throws MessagingExcepti
2523
htmlContent += "<p>If you didn't request a registration, don't worry. You can safely ignore this email.</p><br/><br/>";
2624

2725
MailSenderHandler mailHandler = new MailSenderHandler(sender);
26+
mailHandler.setFrom(from);
2827
mailHandler.setTo(user.getEmail());
2928
mailHandler.setSubject("Databucket account - registration");
3029
mailHandler.setText(htmlContent, true);
3130
mailHandler.send();
3231
}
3332

34-
public void sendRegistrationConfirmation(User user) throws MessagingException {
33+
public void sendRegistrationConfirmation(User user, String from) throws MessagingException {
3534
String htmlContent = "<h2>Databucket account</h2>";
3635

3736
htmlContent += "<p>Your account has been activated.</p>";
3837
htmlContent += "<p>Log in to the application and request to be assigned to the project.</p>";
3938

4039
MailSenderHandler mailHandler = new MailSenderHandler(sender);
40+
mailHandler.setFrom(from);
4141
mailHandler.setTo(user.getEmail());
4242
mailHandler.setSubject("Databucket account - activated");
4343
mailHandler.setText(htmlContent, true);
4444
mailHandler.send();
4545
}
4646

47-
public void sendForgotPasswordLink(User user, String link) throws MessagingException {
47+
public void sendForgotPasswordLink(User user, String link, String from) throws MessagingException {
4848
String htmlContent = "<h2>Databucket account</h2>";
4949
htmlContent += "<h4>Forgot your password?</h4>";
5050
htmlContent += "<p>We received a request to reset the password for your account.</p><br/>";
@@ -56,19 +56,21 @@ public void sendForgotPasswordLink(User user, String link) throws MessagingExcep
5656
htmlContent += "<p>If you didn't request a reset, don't worry. You can safely ignore this email.</p><br/><br/>";
5757

5858
MailSenderHandler mailHandler = new MailSenderHandler(sender);
59+
mailHandler.setFrom(from);
5960
mailHandler.setTo(user.getEmail());
6061
mailHandler.setSubject("Databucket account - forgot your password?");
6162
mailHandler.setText(htmlContent, true);
6263
mailHandler.send();
6364
}
6465

65-
public void sendNewPassword(User user, String password) throws MessagingException {
66+
public void sendNewPassword(User user, String password, String from) throws MessagingException {
6667
String htmlContent = "<h2>Databucket account</h2>";
6768
htmlContent += "<p>Your password has been reset.</p>";
6869
htmlContent += "<p>Below you can find your temporary password:</p>";
6970
htmlContent += "<h2>" + password + "</h2>";
7071

7172
MailSenderHandler mailHandler = new MailSenderHandler(sender);
73+
mailHandler.setFrom(from);
7274
mailHandler.setTo(user.getEmail());
7375
mailHandler.setSubject("Databucket account - temporary password");
7476
mailHandler.setText(htmlContent, true);

src/main/resources/application-default.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ spring:
1414
mail:
1515
host: smtp.gmail.com
1616
port: 587
17-
username: databucket.info@gmail.com
18-
password: *
17+
username: username
18+
password: password
19+
from: admin@email.io
1920
properties.mail.smtp.auth: true
2021
properties.mail.smtp.starttls.enable: true

src/main/resources/banner.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
██████╔╝██║ ██║ ██║ ██║ ██║██████╔╝╚██████╔╝╚██████╗██║ ██╗███████╗ ██║ ██████╔╝
88
╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝
99

10-
Databucket version: (v3.4.0)
10+
Databucket version: (v3.4.1)
1111
Spring Boot version:${spring-boot.formatted-version}

0 commit comments

Comments
 (0)