@Override
	public JSONObject main(Map<String, String> params, Session session) throws Exception
	{
		String username = params.get("username");
		String passwordClear = params.get("password");
		User u = User.findOne("username", username);
		
		JSONObject rtn = new JSONObject();
		if(u == null) {
			rtn.put("rtnCode", this.getRtnCode(201));
			return rtn;
		}
		if(!u.checkPassword(passwordClear)) {
			rtn.put("rtnCode", this.getRtnCode(202));
			return rtn;
		}
		
		session.setActiveUserId(u.getId());
		
		// refresh notification when logging in
		u.refreshNotificaion();
		
		rtn.put("rtnCode", this.getRtnCode(200));
		{
			rtn.put("user", u.toJson());
		}
		
		
		return rtn;
	}