use of app.hongs.action.anno.Verify in project HongsCORE by ihongs.
the class SignAction method signCreate.
/**
* 登录
* @param ah
* @throws HongsException
*/
@Action("create")
@Verify(conf = "master", form = "sign")
public void signCreate(ActionHelper ah) throws HongsException {
String appid = Synt.declare(ah.getParameter("appid"), "_WEB_");
String place = Synt.declare(ah.getParameter("place"), "public");
String username = Synt.declare(ah.getParameter("username"), "");
String password = Synt.declare(ah.getParameter("password"), "");
String passcode;
DB db = DB.getInstance("master");
Table tb = db.getTable("user");
FetchCase fc;
Map ud;
// 验证密码
fc = new FetchCase().from(tb.tableName).select("password, passcode, id, name, head, mtime, state").filter("username = ?", username);
ud = db.fetchLess(fc);
if (ud.isEmpty()) {
ah.reply(AuthKit.getWrong("username", "core.username.invalid"));
return;
}
passcode = Synt.declare(ud.get("passcode"), "");
password = AuthKit.getCrypt(password + passcode);
if (!password.equals(ud.get("password"))) {
ah.reply(AuthKit.getWrong("passowrd", "core.password.invalid"));
return;
}
String usrid = (String) ud.get("id");
String uname = (String) ud.get("name");
String uhead = (String) ud.get("head");
int state = Synt.declare(ud.get("state"), 0);
long utime = Synt.declare(ud.get("mtime"), 0L) * 1000;
// 验证状态
if (1 != state) {
ah.reply(AuthKit.getWrong("state", "core.sign.state.invalid"));
return;
}
// 验证区域
Set rs = RoleSet.getInstance(usrid);
if (0 != place.length() && !rs.contains(place)) {
ah.reply(AuthKit.getWrong("place", "core.sign.place.invalid"));
return;
}
ah.reply(AuthKit.userSign(ah, place, appid, usrid, uname, uhead, utime));
}
use of app.hongs.action.anno.Verify in project HongsCORE by ihongs.
the class UserAction method doSave.
@Action("save")
@Verify(conf = "master", form = "user")
@CommitSuccess
public void doSave(ActionHelper helper) throws HongsException {
Map rd = helper.getRequestData();
// Ignore empty password in update
if ("".equals(rd.get("password"))) {
rd.remove("password");
rd.remove("passcode");
}
String id = model.set(rd);
Map sd = new HashMap();
sd.put("id", id);
sd.put("name", rd.get("name"));
sd.put("head", rd.get("head"));
CoreLocale ln = CoreLocale.getInstance().clone();
ln.load("master");
String ms = ln.translate("core.save.user.success");
helper.reply(ms, sd);
}
use of app.hongs.action.anno.Verify in project HongsCORE by ihongs.
the class JointGate method create.
@Override
@Action("create")
@Preset(conf = "", form = "", deft = { ":create" })
@Select(conf = "", form = "", mode = 2)
@Verify(conf = "", form = "")
@CommitSuccess
public void create(ActionHelper helper) throws HongsException {
IEntity sr = getEntity(helper);
Map rd = helper.getRequestData();
rd = getReqMap(helper, sr, "create", rd);
Map sd = sr.create(rd);
sd = getRspMap(helper, sr, "create", sd);
String ss = getRspMsg(helper, sr, "create", 1);
helper.reply(ss, sd);
}
use of app.hongs.action.anno.Verify in project HongsCORE by ihongs.
the class DBAction method create.
@Action("create")
@Preset(conf = "", form = "", deft = { ":create" })
@Select(conf = "", form = "", mode = 2)
@Verify(conf = "", form = "")
@CommitSuccess
@Override
public void create(ActionHelper helper) throws HongsException {
Model ett = getEntity(helper);
Map req = helper.getRequestData();
req = getReqMap(helper, ett, "create", req);
Map rsp = ett.create(req);
rsp = getRspMap(helper, ett, "create", rsp);
String msg = getRspMsg(helper, ett, "create", 1);
helper.reply(msg, rsp);
}
use of app.hongs.action.anno.Verify in project HongsCORE by ihongs.
the class DBAction method update.
@Action("update")
@Preset(conf = "", form = "", deft = { ":update" })
@Verify(conf = "", form = "")
@CommitSuccess
@Override
public void update(ActionHelper helper) throws HongsException {
Model ett = getEntity(helper);
Map req = helper.getRequestData();
req = getReqMap(helper, ett, "update", req);
int num = ett.update(req);
String msg = getRspMsg(helper, ett, "update", num);
helper.reply(msg, num);
}
Aggregations