jeecgboot/JeecgBoot · warning · JeecgBootException
请填写验证码!
Error message
请填写验证码!
What it means
Thrown by SysUserServiceImpl.changePhone when 'smscode' is empty. It is the second input check, after phone presence.
Source
Thrown at jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java:2080
query.in(SysUser::getId,Arrays.asList(userIds.split(SymbolConstant.COMMA)));
query.eq(SysUser::getUsername,"admin");
Long adminRoleCount = this.baseMapper.selectCount(query);
//大于0说明存在管理员用户,不允许删除
if(adminRoleCount>0){
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);View on GitHub (pinned to 96fb33f5ec)
Solutions
- Ensure the request body includes a non-empty 'smscode'.
- Validate the form field name is exactly 'smscode'.
- If SMS did not arrive, trigger sendChangePhoneSms first, then submit the code.
Example fix
// before: { "phone": "13800000000", "type": "1" } // missing smscode
// after: { "phone": "13800000000", "smscode": "1234", "type": "1" } Defensive patterns
Strategy: validation
Validate before calling
String smscode = json.getString("smscode");
if (oConvertUtils.isEmpty(smscode)) return Result.error("请填写验证码"); Type guard
boolean hasSmsCode(JSONObject json) {
String c = json.getString("smscode");
return c != null && !c.trim().isEmpty();
} Try / catch
try { userService.changePhone(json, username); }
catch (JeecgBootException e) {
if (e.getMessage().contains("验证码")) return Result.error("请填写验证码");
throw e;
} Prevention
- Trigger sendChangePhoneSms before submitting the verify step.
- Confirm field name is 'smscode'.
When it happens
Trigger: POST to changePhone with a JSON body where 'smscode' is null/empty/whitespace.
Common situations: User submitted before entering the SMS code; field name mismatch ('code' vs 'smscode'); SMS never arrived so the field was left blank.
Related errors
AI-assisted analysis of jeecgboot/JeecgBoot@96fb33f5ec (2026-08-14).
Data as JSON: /api/errors/e9bf181efe2780bc.
Report an issue: GitHub.