private void applyLogin(String name, JSONObject json) { JSONObject jsonObj = JSONHelper.getObject(json, "data"); boolean found = JSONHelper.getPrimitiveBoolean(jsonObj, "found", false); if (!found) { Window.alert("Пользователь " + GWTUtils.safeString(name) + " не найден!"); } else { elName.setValue(""); setCurrentUser(name); Window.Location.reload(); } }
private void login() { final String name = elName.getValue().trim(); String pass = elPass.getValue().trim(); elPass.setValue(""); if (GWTUtils.isEmpty(name) || GWTUtils.isEmpty(pass)) { return; } new AjaxRequest(Actions.LOGIN) .addParam("name", name) .addParam("pass", pass) .send( new AjaxCallback() { @Override public void onResponse(JSONObject json) { applyLogin(name, json); } }); }