mirror of
https://github.com/FreeeBird/hotel.git
synced 2025-11-02 21:44:50 +08:00
1.update README
2.密码不用明文存储
This commit is contained in:
@@ -3,6 +3,7 @@ package cn.mafangui.hotel.service.impl;
|
||||
import cn.mafangui.hotel.entity.User;
|
||||
import cn.mafangui.hotel.mapper.UserMapper;
|
||||
import cn.mafangui.hotel.service.UserService;
|
||||
import cn.mafangui.hotel.utils.MD5Utils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -20,11 +21,13 @@ public class UserServiceImpl implements UserService {
|
||||
|
||||
@Override
|
||||
public int addUser(User user) {
|
||||
user.setPassword(MD5Utils.MD5Encode(user.getPassword()));
|
||||
return userMapper.insertSelective(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertUser(User user) {
|
||||
user.setPassword(MD5Utils.MD5Encode(user.getPassword()));
|
||||
return userMapper.insert(user);
|
||||
}
|
||||
|
||||
@@ -40,7 +43,8 @@ public class UserServiceImpl implements UserService {
|
||||
|
||||
@Override
|
||||
public User selectByUsernameAndPassword(String username, String password) {
|
||||
return userMapper.selectByUsernameAndPassword(username,password);
|
||||
String pass = MD5Utils.MD5Encode(password);
|
||||
return userMapper.selectByUsernameAndPassword(username,pass);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user