Exemplo n.º 1
0
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest req, HttpServletResponse resp ){
		
		if("GET".equals(req.getMethod())){
			JSONObject json = AndroidHelper.DoGetForbiddenException();
			req.setAttribute("json", json.toString());
			return mapping.findForward("succes");
		
		}else if("POST".equals(req.getMethod())){
			
			String email = request.getParameter("mail");
			String mdp = req.getParameter("mdp");
			org.json.JSONObject json = new JSONObject();
			PersonneDAO persDAO = new PersonneDAO();
			
			// check the login and the pwd
			if( mail != null && mdp != null){
				Personne p = persDAO.getmailPersonne(mail);
				// managing the misfound exceptions
				if(p == null) {
					json = AndroidHelper.UserNotFoundException();
				// Uncorrect password
				}else if(!mdp.equals(p.getmdpPersonne())){
					json = AndroidHelper.PassIncorrectException()
				} else {
					p.setmailPersonne("");
					p.setmdpPersonne("");
					json = new JSONObject(p);
				}
			
			} else{
Exemplo n.º 2
0
			} else{
				json = AndroidHelper.MissingArgException();
			}