jeecgboot/JeecgBoot · error · JeecgBootException
500
500
Error message
原手机号不匹配,无法修改密码!
What it means
Thrown by SysUserServiceImpl.changePhone step1 when userMapper.getUserByNameAndPhone(phone, username) returns null - the submitted original phone does not belong to the current user account. Reported (misleadingly) as 'cannot modify password' though this is the phone-change flow.
Source
Thrown at jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java:2085
throw new JeecgBootException("admin用户,不允许删除!");
}
}
@Override
public void changePhone(JSONObject json, String username) {
String smscode = json.getString("smscode");
String phone = json.getString("phone");
String type = json.getString("type");
if(oConvertUtils.isEmpty(phone)){
throw new JeecgBootException("请填写原手机号!");
}
if(oConvertUtils.isEmpty(smscode)){
throw new JeecgBootException("请填写验证码!");
}
//step1 验证原手机号是否和当前用户匹配
SysUser sysUser = userMapper.getUserByNameAndPhone(phone,username);
if (null == sysUser){
throw new JeecgBootException("原手机号不匹配,无法修改密码!");
}
//step2 根据类型判断是验证原手机号的验证码还是新手机号的验证码
//验证原手机号
if(CommonConstant.VERIFY_ORIGINAL_PHONE.equals(type)){
this.verifyPhone(phone, smscode);
}else if(CommonConstant.UPDATE_PHONE.equals(type)){
//修改手机号
String newPhone = json.getString("newPhone");
//需要验证新手机号和原手机号是否一致,一致不让修改
if(newPhone.equals(phone)){
throw new JeecgBootException("新手机号与原手机号一致,无法修改!");
}
this.verifyPhone(newPhone, smscode);
//step3 新手机号验证码验证成功之后即可修改手机号
sysUser.setPhone(newPhone);
userMapper.updateById(sysUser);
}
}View on GitHub (pinned to 96fb33f5ec)
Solutions
- Have the user re-enter their current registered phone number exactly as stored.
- Check sys_user.phone for the logged-in username and use that value.
- Normalize phone format (strip spaces/country code) before comparing if storage is inconsistent.
- If the stored phone is wrong, correct it in the DB or via the reset flow.
Example fix
// before: { "phone": "13900000000", ... } // wrong original phone
// after: look up the real stored phone
SysUser u = userMapper.getUserByName(username);
// populate form with u.getPhone(), then submit Defensive patterns
Strategy: validation
Validate before calling
SysUser u = userMapper.getUserByNameAndPhone(phone, username);
if (u == null) return Result.error("原手机号不匹配"); Type guard
boolean phoneBelongsToUser(String phone, String username) {
return userMapper.getUserByNameAndPhone(phone, username) != null;
} Try / catch
try { userService.changePhone(json, username); }
catch (JeecgBootException e) {
if (e.getMessage().contains("原手机号不匹配")) return Result.error("请输入正确的原手机号");
throw e;
} Prevention
- Pre-fill the original phone from sys_user for the logged-in user.
- Normalize phone formatting before comparison.
- Note the message says 'password' but means phone - do not be misled.
When it happens
Trigger: changePhone called with a 'phone' (original phone) that does not match any sys_user row for the given username.
Common situations: User mistyped the original phone; the account's phone was changed already; phone stored with country code or formatting differences; username in session differs from the account that owns the phone.
Related errors
AI-assisted analysis of jeecgboot/JeecgBoot@96fb33f5ec (2026-08-14).
Data as JSON: /api/errors/30eb3566d4fcace6.
Report an issue: GitHub.