use of com.baidu.dsp.common.exception.FieldException in project disconf by knightliao.
the class AuthValidator method validatePasswordModify.
/**
* 验证密码更新
*/
public void validatePasswordModify(PasswordModifyForm passwordModifyForm) {
Visitor visitor = ThreadContext.getSessionVisitor();
User user = userMgr.getUser(visitor.getLoginUserId());
// 校验密码
if (!signMgr.validate(user.getPassword(), passwordModifyForm.getOld_password())) {
throw new FieldException(PasswordModifyForm.OLD_PASSWORD, "password.not.right", null);
}
if (!passwordModifyForm.getNew_password().equals(passwordModifyForm.getNew_password_2())) {
throw new FieldException(PasswordModifyForm.NEW_PASSWORD, "two.password.not.equal", null);
}
}
use of com.baidu.dsp.common.exception.FieldException in project disconf by knightliao.
the class ZkDeployValidator method verify.
/**
* @param zkDeployForm
*
* @return
*/
public ConfigFullModel verify(ZkDeployForm zkDeployForm) {
//
if (zkDeployForm.getAppId() == null) {
throw new FieldException("app is empty", null);
}
App app = appMgr.getById(zkDeployForm.getAppId());
if (app == null) {
throw new FieldException("app " + zkDeployForm.getAppId() + " doesn't exist in db.", null);
}
//
if (zkDeployForm.getEnvId() == null) {
throw new FieldException("app is empty", null);
}
Env env = envMgr.getById(zkDeployForm.getEnvId());
if (env == null) {
throw new FieldException("env " + zkDeployForm.getEnvId() + " doesn't exist in db.", null);
}
//
if (StringUtils.isEmpty(zkDeployForm.getVersion())) {
throw new FieldException("version is empty", null);
}
return new ConfigFullModel(app, env, zkDeployForm.getVersion(), "");
}
Aggregations