#
vincentlu
2025-02-10 80a82efcb42ba4b6f24768e780b1b3f51e3141f4
#
5个文件已修改
36 ■■■■ 已修改文件
rsf-admin/src/api/auth/index.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/i18n/zh.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/page/settings/SecuritySettings.jsx 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/system/controller/AuthController.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/system/controller/param/UpdatePasswordParam.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/api/auth/index.js
@@ -39,3 +39,8 @@
    }
    return Promise.reject(new Error(res.data.msg));
}
export async function requestResetPassword(_params) {
    const res = await request.post('/auth/reset/password', _params);
    return res.data;
}
rsf-admin/src/i18n/zh.js
@@ -220,7 +220,7 @@
        }
    },
    page: {
        welcome: '    Welcome to the RSF Management System.',
        welcome: '  欢迎使用RSF管理系统',
        login: {
            title: 'Welcome',
            footer: 'Footer Goes Here',
rsf-admin/src/page/settings/SecuritySettings.jsx
@@ -14,7 +14,7 @@
    InputAdornment,
    IconButton,
} from '@mui/material';
import { updateUserInfo } from '@/api/auth';
import { requestResetPassword } from '@/api/auth';
import Visibility from '@mui/icons-material/Visibility';
import VisibilityOff from '@mui/icons-material/VisibilityOff';
@@ -39,22 +39,19 @@
    }, [userInfo, setValue])
    const onSubmit = (data) => {
        console.log(data);
        return false;
        setLoading(true);
        updateUserInfo({ id: userInfo.id, ...data }).then(res => {
        requestResetPassword(data).then(res => {
            setLoading(false);
            const { code, msg, data } = res;
            if (code === 200) {
                notify(msg, { type: 'success', messageArgs: { _: msg } });
                reset();
            } else if (code === 408) {
                setError('oldPassword', {
                    message: msg,
                });
            } else {
                notify(msg, { type: 'error', messageArgs: { _: msg } });
                setError('oldPassword', {
                    type: 'server', // make no sense
                    message: res.msg,
                });
            }
        }).catch((error) => {
            setLoading(false);
rsf-server/src/main/java/com/vincent/rsf/server/system/controller/AuthController.java
@@ -106,9 +106,9 @@
    }
    @OperationLog("Reset Password")
    @PostMapping("/auth/password")
    @PostMapping("/auth/reset/password")
    public R resetPassword(@RequestBody UpdatePasswordParam param) {
        if (Cools.isEmpty(param.getOldPassword(), param.getPassword())) {
        if (Cools.isEmpty(param.getOldPassword(), param.getNewPassword())) {
            return R.error("Parameters Cannot Be Empty");
        }
        Long userId = getLoginUserId();
@@ -116,15 +116,15 @@
            return R.error("Please Login First");
        }
        if (!userService.comparePassword(userService.getById(userId).getPassword(), param.getOldPassword())) {
            return R.error("The Origin Password Was Incorrect");
            return R.parse("408-The Current Password Was Incorrect");
        }
        User user = new User();
        user.setId(userId);
        user.setPassword(userService.encodePassword(param.getPassword()));
        user.setPassword(userService.encodePassword(param.getNewPassword()));
        if (userService.updateById(user)) {
            return R.ok("Update Success");
            return R.ok("Reset Password Success");
        }
        return R.error("Update Fail");
        return R.error("Reset Password Fail");
    }
rsf-server/src/main/java/com/vincent/rsf/server/system/controller/param/UpdatePasswordParam.java
@@ -11,6 +11,6 @@
    private String oldPassword;
    private String password;
    private String newPassword;
}