弱密码处理

master
chen 4 years ago
parent 2f33e4f522
commit ce48bb49a4
  1. 27
      src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
  2. 17
      src/main/java/com/yipin/liuwanr/entity/vo/AccountLoginVO.java
  3. 16
      src/main/java/com/yipin/liuwanr/entity/vo/AdminLoginVO.java
  4. 10
      src/main/java/com/yipin/liuwanr/service/UserInfoService.java

@ -1,6 +1,8 @@
package com.yipin.liuwanr.controller;
import com.yipin.liuwanr.entity.*;
import com.yipin.liuwanr.entity.vo.AccountLoginVO;
import com.yipin.liuwanr.entity.vo.AdminLoginVO;
import com.yipin.liuwanr.helper.RedisHelper;
import com.yipin.liuwanr.service.*;
import com.yipin.liuwanr.vo.UserInfoVO;
@ -11,7 +13,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.security.Permissions;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -304,10 +305,13 @@ public class UserInfoController {
/**
* 登陆查询学校/电子科大
*/
@GetMapping("/loginSchoolClient")
Response loginSchoolClient(@RequestParam("account") String account, @RequestParam("password") String password, @RequestParam("schoolId") Integer schoolId ,
@RequestParam("source") Integer source, HttpServletRequest req, HttpServletResponse res) {
@PostMapping("/loginSchoolClient")
Response loginSchoolClient(@RequestBody AccountLoginVO accountLogin) {
Response resp = new Response();
String account = accountLogin.getAccount();
String password = accountLogin.getPassword();
Integer schoolId = accountLogin.getSchoolId();
Integer source = accountLogin.getSource();
if (account == null || account=="") {
resp.setStatus(300);
resp.setErrmessage("用户账号为空,登录失败!");
@ -331,17 +335,14 @@ public class UserInfoController {
/**
* 服务端登陆
*
* @param account source是0就是用户账号1则是手机号或邮箱
* @param password 密码
* @param source 来源区分
* 科大教师端登陆
*/
@GetMapping("/adminLogins")
Response adminLogins(@RequestParam("account") String account, @RequestParam("password") String password,
@RequestParam("source") Integer source, HttpServletRequest req, HttpServletResponse res) {
@PostMapping("/adminLogins")
public Response adminLogins(@RequestBody AdminLoginVO adminLogin) {
Response resp = new Response();
String account = adminLogin.getAccount();
String password = adminLogin.getPassword();
Integer source = adminLogin.getSource();
HashMap<String, Object> map = new HashMap<>();
if (account == null) {
resp.setStatus(300);

@ -0,0 +1,17 @@
package com.yipin.liuwanr.entity.vo;
import lombok.Data;
/**
* @Author chen
* @DATE 2021/6/7 16:20
* @Version 1.0
*/
@Data
public class AccountLoginVO {
private String account;
private String password;
private Integer source;
private Integer schoolId;
}

@ -0,0 +1,16 @@
package com.yipin.liuwanr.entity.vo;
import lombok.Data;
/**
* @Author chen
* @DATE 2021/6/7 15:35
* @Version 1.0
*/
@Data
public class AdminLoginVO {
private String account;
private String password;
private Integer source;
}

@ -508,7 +508,7 @@ public class UserInfoService {
public HashMap<String, Object> adminLogins(String account,String password,Integer source){
HashMap<String, Object> resp = new HashMap<String, Object>();
UserInfo user = new UserInfo();
user.setPassword(password);
user.setPassword(MD5.encrypt(password));
try {
if (source == 0){
user.setAccount(account);
@ -526,12 +526,6 @@ public class UserInfoService {
}
user = userInfoMapper.adminLogins(user);
//区分密码大小写
boolean num = false;
if (user != null){
num = password.equals(user.getPassword());
user.setPassword(null);
}
if(user != null){
if (user.getRoleId().contains("1")){
user.setSchoolId(null);
@ -540,7 +534,7 @@ public class UserInfoService {
user.setSchoolId(schoolId);
}
}
if (num == false || user == null){
if (user == null){
resp.put("retvalue","账号密码有误,请稍后再试!");
resp.put("retcode", 300);
}else{

Loading…
Cancel
Save