use of app.hongs.action.anno.Verify in project HongsCORE by ihongs.
the class MineAction method mineUpdate.
@Action("update")
@Verify(conf = "master", form = "mine", type = 1, trim = 1)
public void mineUpdate(ActionHelper ah) throws HongsException {
Map rd = ah.getRequestData();
String id = (String) ah.getSessibute(Cnst.UID_SES);
// 禁止危险修改
rd.put("id", id);
rd.remove("roles");
rd.remove("rtime");
rd.remove("mtime");
rd.remove("ctime");
rd.remove("state");
// 验证原始密码
String pw = (String) rd.get("password");
String po = (String) rd.get("passolde");
if (pw != null && !"".equals(pw)) {
Map xd = new HashMap();
Map ed = new HashMap();
xd.put("errs", ed);
xd.put("ok", false);
xd.put("msg", CoreLocale.getInstance().translate("fore.form.invalid"));
if (po != null && !"".equals(po)) {
Map row = DB.getInstance("master").getTable("user").fetchCase().filter("id = ?", id).select("password").one();
po = AuthKit.getCrypt(po);
if (!po.equals(row.get("password"))) {
ed.put("passolde", "旧密码不正确");
ah.reply(xd);
return;
}
} else {
ed.put("passolde", "请填写旧密码");
ah.reply(xd);
return;
}
}
UserAction ua = new UserAction();
ua.doSave(ah);
}
use of app.hongs.action.anno.Verify in project HongsCORE by ihongs.
the class SignAction method userCreate.
/**
* 注册
* @param ah
* @throws app.hongs.HongsException
*/
@Action("user/create")
@Preset(conf = "master", form = "mine")
@Verify(conf = "master", form = "mine")
public void userCreate(ActionHelper ah) throws HongsException {
Map rd = ah.getRequestData();
User uo = (User) DB.getInstance("master").getModel("user");
Map sd = uo.create(rd);
// 提取登录信息
String usrid = Synt.declare(sd.get("id"), "");
String uname = Synt.declare(sd.get("name"), "");
String uhead = Synt.declare(sd.get("head"), "");
long utime = Synt.declare(sd.get("mtime"), 0L) * 1000;
String appid = Synt.declare(ah.getParameter("appid"), "_WEB_");
// 赋予公共权限
sd = new HashMap();
sd.put("user_id", usrid);
sd.put("role", "public");
uo.db.getTable("user_role").insert(sd);
// 加入公共部门
sd = new HashMap();
sd.put("user_id", usrid);
sd.put("dept_id", "PUBLIC");
uo.db.getTable("user_dept").insert(sd);
ah.reply(AuthKit.userSign(ah, null, appid, usrid, uname, uhead, utime));
}
use of app.hongs.action.anno.Verify in project HongsCORE by ihongs.
the class UnitAction method doSave.
@Action("save")
@Verify(conf = "matrix", form = "unit")
@CommitSuccess
public void doSave(ActionHelper helper) throws HongsException {
Map data = helper.getRequestData();
String id = model.set(data);
Map info = new HashMap();
info.put("id", id);
info.put("name", data.get("name"));
CoreLocale lang = CoreLocale.getInstance().clone();
lang.load("matrix");
String ms = lang.translate("core.save.unit.success");
helper.reply(ms, info);
}
use of app.hongs.action.anno.Verify in project HongsCORE by ihongs.
the class JointGate method update.
@Override
@Action("update")
@Preset(conf = "", form = "", deft = { ":update" })
@Verify(conf = "", form = "")
@CommitSuccess
public void update(ActionHelper helper) throws HongsException {
IEntity sr = getEntity(helper);
Map rd = helper.getRequestData();
rd = getReqMap(helper, sr, "update", rd);
int sn = sr.update(rd);
String ss = getRspMsg(helper, sr, "update", sn);
helper.reply(ss, sn);
}
Aggregations