Procházet zdrojové kódy

updatePassword api.

deason před 6 roky
rodič
revize
7e11eccbbd

+ 3 - 2
src/main/java/cn/com/qmth/examcloud/app/controller/version1/UserAuthRestController.java

@@ -64,8 +64,9 @@ public class UserAuthRestController {
 
     @ApiOperation(value = "修改密码接口")
     @RequestMapping(value = "/user/update/password", method = {RequestMethod.GET, RequestMethod.POST})
-    public Result updatePassword(@RequestHeader String key, @RequestHeader String token, @RequestParam Long userId, @RequestParam String password) throws Exception {
-        return userAuthService.updatePassword(key, token, userId, password);
+    public Result updatePassword(@RequestHeader String key, @RequestHeader String token, @RequestParam Long studentId, @RequestParam String password,
+                                 @RequestParam String newPassword) throws Exception {
+        return userAuthService.updateStudentPassword(key, token, studentId, password, newPassword);
     }
 
     @ApiOperation(value = "保存用户绑定的手机号接口")

+ 3 - 2
src/main/java/cn/com/qmth/examcloud/app/service/UserAuthService.java

@@ -54,12 +54,13 @@ public interface UserAuthService {
      *
      * @param key
      * @param token
-     * @param userId
+     * @param studentId
      * @param password
+     * @param newPassword
      * @return
      * @throws Exception
      */
-    Result updatePassword(String key, String token, Long userId, String password) throws Exception;
+    Result updateStudentPassword(String key, String token, Long studentId, String password, String newPassword) throws Exception;
 
     /**
      * 获取短信验证码

+ 5 - 4
src/main/java/cn/com/qmth/examcloud/app/service/impl/UserAuthServiceImpl.java

@@ -104,13 +104,14 @@ public class UserAuthServiceImpl implements UserAuthService {
     }
 
     @Override
-    public Result updatePassword(String key, String token, Long userId, String password) throws Exception {
-        Assert.notNull(userId, "UserId must be not null.");
+    public Result updateStudentPassword(String key, String token, Long studentId, String password, String newPassword) throws Exception {
+        Assert.notNull(studentId, "StudentId must be not null.");
         //封装请求参数
-        final String requestUrl = String.format("%s/api/ecs_core/user/password", propertyService.getUserAuthUrl());
+        final String requestUrl = String.format("%s/api/ecs_core/student/password", propertyService.getUserAuthUrl());
         RequestBody formBody = new FormBody.Builder()
-                .add("userId", userId.toString())
+                .add("studentId", studentId.toString())
                 .add("password", password)
+                .add("newPassword", password)
                 .build();
         return HttpUtils.doPut(requestUrl, formBody, key, token);
     }