Przeglądaj źródła

增加删除账户功能
处理翻译

wzh 2 lat temu
rodzic
commit
72ca92860e

+ 20 - 0
ruoyi-admin/scan.html

@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <title>Password Reset</title>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta http-equiv="Content-Type" content="multipart/form-data; charset=utf-8">
+</head>
+<body>
+
+<div>
+    <input placeholder="请输入设备序列号"/>
+</div>
+
+
+<div>
+    <button>提交</button>
+
+</div>
+</body>
+</html>

+ 1 - 1
ruoyi-admin/src/main/resources/application-dev.yml

@@ -43,7 +43,7 @@ logging:
 user:
   password:
     # 密码最大错误次数
-    maxRetryCount: 5
+    maxRetryCount: 500
     # 密码锁定时间(默认10分钟)
     lockTime: 10
 

+ 2 - 2
ruoyi-admin/src/main/resources/application-guowai.yml

@@ -43,7 +43,7 @@ logging:
 user:
   password:
     # 密码最大错误次数
-    maxRetryCount: 5
+    maxRetryCount: 50
     # 密码锁定时间(默认10分钟)
     lockTime: 10
 
@@ -153,7 +153,7 @@ xxl:
     executor:
       address: ''
       appname: weitiandi-job
-      ip: 192.168.10.90
+      ip: 192.168.10.100
       logpath: /data/applogs/xxl-job/jobhandler
       logretentiondays: 30
       port: 8055

+ 1 - 1
ruoyi-admin/src/main/resources/application-prod.yml

@@ -43,7 +43,7 @@ logging:
 user:
   password:
     # 密码最大错误次数
-    maxRetryCount: 5
+    maxRetryCount: 50
     # 密码锁定时间(默认10分钟)
     lockTime: 10
 

+ 3 - 3
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java

@@ -40,17 +40,17 @@ public class UserDetailsServiceImpl implements UserDetailsService
         if (StringUtils.isNull(user))
         {
             log.info("登录用户:{} 不存在.", username);
-            throw new ServiceException("登录用户:" + username + " 不存在");
+            throw new ServiceException("User " + username + " does not exist.");
         }
         else if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
         {
             log.info("登录用户:{} 已被删除.", username);
-            throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
+            throw new ServiceException("Your account: " + username + " has been deleted.");
         }
         else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
         {
             log.info("登录用户:{} 已被停用.", username);
-            throw new ServiceException("对不起,您的账号:" + username + " 已停用");
+            throw new ServiceException("Your account: " + username + " has been disabled.");
         }
 
         passwordService.validate(user);

+ 9 - 0
ruoyi-thirduser/src/main/java/com/ruoyi/thirduser/controller/LoginController.java

@@ -5,6 +5,7 @@ import com.ruoyi.common.constant.Constants;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginBody;
 import com.ruoyi.common.core.domain.model.RegisterBody;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.thirduser.service.ThirdUserloginService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;import org.springframework.web.bind.annotation.PostMapping;
@@ -36,4 +37,12 @@ public class LoginController {
         AjaxResult ajax = AjaxResult.success(s);
         return ajax;
     }
+    @PostMapping("/deleteUser")
+    public AjaxResult registerByMail(){
+        Long userId = SecurityUtils.getLoginUser().getUserId();
+        int i = thirdUserloginService.deleteUser(userId);
+        AjaxResult ajax = AjaxResult.success(i);
+        return ajax;
+    }
+
 }

+ 17 - 7
ruoyi-thirduser/src/main/java/com/ruoyi/thirduser/service/ThirdUserloginService.java

@@ -77,7 +77,7 @@ public class ThirdUserloginService  {
             else
             {
                 AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
-                throw new ServiceException(e.getMessage());
+                throw new ServiceException(toEn(e.getMessage()));
             }
         }
         finally
@@ -91,6 +91,12 @@ public class ThirdUserloginService  {
         return tokenService.createToken(loginUser);
     }
 
+    private String toEn(String msg){
+        if("用户不存在/密码错误".equals(msg)){
+            return "User does not exist/Incorrect password.";
+        }
+        return msg;
+    }
 
     public String mailRegister(String username,String password){
         SysUser user = new SysUser();
@@ -101,25 +107,25 @@ public class ThirdUserloginService  {
 
         if (StringUtils.isEmpty(username))
         {
-            msg = "用户名不能为空";
+            msg = "Username cannot be empty.";
         }
         else if (StringUtils.isEmpty(password))
         {
-            msg = "用户密码不能为空";
+            msg = "User password cannot be empty.";
         }
         else if (!StringUtils.isMail(username))
         {
-            msg = "账户名必须是邮箱格式";
+            msg = "The account name must be in email format.";
         }
 
         else if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
                 || password.length() > UserConstants.PASSWORD_MAX_LENGTH)
         {
-            msg = "密码长度必须在5到20个字符之间";
+            msg = "The password length must be between 5 and 20 characters.";
         }
         else if (!userService.checkUserNameUnique(sysUser))
         {
-            msg = "注册账号已存在";
+            msg = "The registered account already exists.";
         }
         else
         {
@@ -130,7 +136,7 @@ public class ThirdUserloginService  {
             boolean regFlag = userService.registerUser(sysUser);
             if (!regFlag)
             {
-                msg = "注册失败,请稍后再试";
+                msg = "Registration failed, please try again later.";
             }
             else
             {
@@ -139,4 +145,8 @@ public class ThirdUserloginService  {
         }
         return msg;
     }
+
+    public int deleteUser(Long userId) {
+       return userService.deleteUserById(userId);
+    }
 }