Skip to content

Commit

Permalink
gwt: Don't process username/userid fields in case of failed authentic…
Browse files Browse the repository at this point in the history
…ation.
  • Loading branch information
calin-iorgulescu committed Jan 22, 2015
1 parent e17e8fd commit f62f9be
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,16 @@ public AuthenticationResponse decode(String text) throws Exception {
JSONObject jsonObj = jsonValue.isObject();

boolean status = jsonObj.get(statusKey).isBoolean().booleanValue();
String info = jsonObj.get(infoKey).isString().stringValue();
if (!status) {
/*
* Authentication failed.
*/
return new AuthenticationResponse(status, null, info);
}

String username = jsonObj.get(usernameKey).isString().stringValue();
String userid = jsonObj.get(useridKey).isString().stringValue();
String info = jsonObj.get(infoKey).isString().stringValue();
return new AuthenticationResponse(status, new User(userid, username), info);
}

Expand Down

0 comments on commit f62f9be

Please sign in to comment.