mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
Add verification: the user can set a password with a length of less than 6 digits when updating the password, but the password length must be greater than or equal to 6 digits when logging in to canal admin, so the length verification function when updating the login password is added (#4103)
This commit is contained in:
@@ -21,6 +21,8 @@ public class UserServiceImpl implements UserService {
|
|||||||
|
|
||||||
private static byte[] seeds = "canal is best!".getBytes();
|
private static byte[] seeds = "canal is best!".getBytes();
|
||||||
|
|
||||||
|
private static final Integer PASSWORD_LENGTH = 6;
|
||||||
|
|
||||||
public User find4Login(String username, String password) {
|
public User find4Login(String username, String password) {
|
||||||
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
|
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
|
||||||
return null;
|
return null;
|
||||||
@@ -43,6 +45,9 @@ public class UserServiceImpl implements UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void update(User user) {
|
public void update(User user) {
|
||||||
|
if (user.getPassword().length() < PASSWORD_LENGTH) {
|
||||||
|
throw new ServiceException("The new password is too short,must more than 6 digits");
|
||||||
|
}
|
||||||
User userTmp = User.find.query().where().eq("username", user.getUsername()).findOne();
|
User userTmp = User.find.query().where().eq("username", user.getUsername()).findOne();
|
||||||
if (userTmp == null) {
|
if (userTmp == null) {
|
||||||
throw new ServiceException();
|
throw new ServiceException();
|
||||||
|
|||||||
Reference in New Issue
Block a user