mirror of
https://github.com/ZSCNetSupportDept/WechatTicketSystem.git
synced 2025-10-28 23:55:04 +08:00
invalidate session appropriately
This commit is contained in:
@@ -65,7 +65,7 @@ public class Register extends HttpServlet {
|
|||||||
);
|
);
|
||||||
boolean isSuccess = result.equals("Register_Success");
|
boolean isSuccess = result.equals("Register_Success");
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
request.getSession().invalidate();
|
session.invalidate();
|
||||||
out.println(ParseUtil.parseJsonP(request, gson.toJson(new Response(Response.ResponseCode.OK, result))));
|
out.println(ParseUtil.parseJsonP(request, gson.toJson(new Response(Response.ResponseCode.OK, result))));
|
||||||
} else {
|
} else {
|
||||||
out.println(ParseUtil.parseJsonP(request, gson.toJson(new Response(Response.ResponseCode.REQUEST_FAILED, result))));
|
out.println(ParseUtil.parseJsonP(request, gson.toJson(new Response(Response.ResponseCode.REQUEST_FAILED, result))));
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class TicketSubmit extends HttpServlet {
|
|||||||
|
|
||||||
private Response submit(HttpServletRequest request) {
|
private Response submit(HttpServletRequest request) {
|
||||||
String desc = request.getParameter("desc");
|
String desc = request.getParameter("desc");
|
||||||
if (desc == null) {
|
if (desc == null || desc.isEmpty()) {
|
||||||
return new Response(Response.ResponseCode.PARAMETER_REQUIRED);
|
return new Response(Response.ResponseCode.PARAMETER_REQUIRED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,6 +62,7 @@ public class TicketSubmit extends HttpServlet {
|
|||||||
if (u == null) return new Response(Response.ResponseCode.UNAUTHORIZED);
|
if (u == null) return new Response(Response.ResponseCode.UNAUTHORIZED);
|
||||||
|
|
||||||
if (TableTicket.hasOpen(u)) {
|
if (TableTicket.hasOpen(u)) {
|
||||||
|
session.invalidate();
|
||||||
return new Response(Response.ResponseCode.ALREADY_SUBMITTED);
|
return new Response(Response.ResponseCode.ALREADY_SUBMITTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +73,7 @@ public class TicketSubmit extends HttpServlet {
|
|||||||
s.beginTransaction();
|
s.beginTransaction();
|
||||||
s.save(t);
|
s.save(t);
|
||||||
s.getTransaction().commit();
|
s.getTransaction().commit();
|
||||||
request.getSession().invalidate();
|
session.invalidate();
|
||||||
return new Response(Response.ResponseCode.OK, t);
|
return new Response(Response.ResponseCode.OK, t);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
return new Response(Response.ResponseCode.ILLEGAL_PARAMETER);
|
return new Response(Response.ResponseCode.ILLEGAL_PARAMETER);
|
||||||
|
|||||||
Reference in New Issue
Block a user