NutzCN Logo
问答 视图 @Ok("re") 如何返回字符串
发布于 1823天前 作者 JsckChin 1879 次浏览 复制 上一个帖子 下一个帖子
标签:
/**
	 * @Description:设置密码并激活账号
	 */
	@At("/auth/active")
	@Ok("re")
	public String active(@Param("token")String token, HttpSession session){

		if (Strings.isBlank(token)) {
			return "请不要直接访问这个链接!!!";
		}

		if (token.length() < 10) {
			return "非法token";
		}
		try {
			token = Toolkit._3DES_decode(emailKEY, Toolkit.hexstr2bytearray(token));
			if (token == null)
				return "非法token";
			String[] tmp = token.split(",", 3);
			if (tmp.length != 3 || tmp[0].length() == 0 || tmp[1].length() == 0 || tmp[2].length() == 0)
				return "非法token";
			long time = Long.parseLong(tmp[2]);
			if (System.currentTimeMillis() - time > 30*60*1000) {
				return "该验证链接已经超时";
			}
			String userId = tmp[0];
			Cnd cnd = Cnd.where("id", "=", userId).and("email", "=", tmp[1]);
			int re = userService.update( Chain.make("isActivate", true), cnd);
			if (re == 1) {
				// 设置密码并激活账户
				return "beetl:app/setpasw.html";
			}
			return "验证失败!!请重新验证!!";
		} catch (Throwable e) {
			log.debug("检查token时出错", e);
			return "非法token";
		}

	}
3 回复

那何如跳转到 视图 beetl:app/setpasw.html

别想着干两件事

添加回复
请先登陆
回到顶部