|
|
|
@ -59,14 +59,28 @@ public class AdminServiceImpl implements AdminService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Admin login(String name, String password) throws Exception {
|
|
|
|
|
public Admin loginold(String name, String password) throws Exception {
|
|
|
|
|
List<Admin> list = repository.findByName(name);
|
|
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
|
|
throw new BusinessException("用户或密码不正确");
|
|
|
|
|
}
|
|
|
|
|
Admin admin = list.get(0);
|
|
|
|
|
String newPwd = RsaUtils.decryptByPrivateKey(bizConfig.getRsakey(), password);
|
|
|
|
|
String userPassword = DigestUtils.md5DigestAsHex(newPwd.getBytes());
|
|
|
|
|
String userPassword = DigestUtils.md5DigestAsHex(password.getBytes());
|
|
|
|
|
if (!admin.getPassword().equals(userPassword)) {
|
|
|
|
|
throw new BusinessException("用户或密码不正确");
|
|
|
|
|
}
|
|
|
|
|
return admin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Admin login(Admin user) throws Exception {
|
|
|
|
|
List<Admin> list = repository.findByName(user.getName());
|
|
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
|
|
throw new BusinessException("用户或密码不正确");
|
|
|
|
|
}
|
|
|
|
|
Admin admin = list.get(0);
|
|
|
|
|
String userPassword = DigestUtils.md5DigestAsHex(user.getPassword().getBytes());
|
|
|
|
|
if (!admin.getPassword().equals(userPassword)) {
|
|
|
|
|
throw new BusinessException("用户或密码不正确");
|
|
|
|
|
}
|
|
|
|
|