use of io.github.ihongs.serv.master.User in project HongsCORE by ihongs.
the class SignAction method userCreate.
/**
* 注册
* @param ah
* @throws HongsException
*/
@Action("user/create")
@Verify(conf = "master", form = "regs", type = 0, trim = 1)
@CommitSuccess
public void userCreate(ActionHelper ah) throws HongsException {
CoreConfig cc = CoreConfig.getInstance("master");
if (!cc.getProperty("core.public.regs.open", true)) {
throw new HongsException(404, "Sign on is not allowed");
}
User uo = (User) DB.getInstance("master").getModel("user");
Map rd = ah.getRequestData();
String uuid = uo.create(rd);
String uname = Synt.declare(rd.get("name"), "");
String uhead = Synt.declare(rd.get("head"), "");
// 加入公共部门
Map sd = new HashMap();
sd.put("user_id", uuid);
sd.put("dept_id", cc.getProperty("core.public.regs.dept", "CENTRE"));
uo.db.getTable("dept_user").insert(sd);
// 赋予公共权限. 仅用部门即可(2019/02/28)
// Map sd = new HashMap();
// sd.put("user_id", uuid);
// sd.put("role" , cc.getProperty("core.public.regs.role", "centre"));
// uo.db.getTable("user_role").insert(sd);
// * 表示密码登录
Map ad = AuthKit.userSign(ah, "*", uuid, uname, uhead);
ah.reply(Synt.mapOf("info", ad));
}
use of io.github.ihongs.serv.master.User in project HongsCORE by ihongs.
the class SignAction method userUnique.
/**
* 查重
* @param ah
* @throws HongsException
*/
@Action("user/unique")
public void userUnique(ActionHelper ah) throws HongsException {
User uo = (User) DB.getInstance("master").getModel("user");
Map rd = ah.getRequestData();
boolean v = uo.unique(rd);
ah.reply(null, v ? 1 : 0);
}
Aggregations