if (user != null) {
addToTracker(user.getId());
return true;
}
User newUser = new User();
newUser.setgPlusId(gPlusId);
newUser.setFirstName(userInfo.getJSONObject("name").getString("givenName"));
newUser.setSecondName(userInfo.getJSONObject("name").getString("familyName"));
newUser.setEmail(userInfo.optString("email", "mail@mail.com"));
String username = userInfo.optString("nickname", newUser.getFirstName());
newUser.setLogin(username);
String sex = userInfo.getString("gender");
newUser.setSex(sex.equals("male") ? Sex.MALE : Sex.FEMALE);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String birthday = userInfo.optString("birthday", "1900-01-01");
newUser.setBirthDate(sdf.parse(birthday));
// random password, the user will not be using this to log in
newUser.setPasswordHash(HashUtils.hash("gPlus" + System.currentTimeMillis()));
userAction.register(newUser);
userBean.gPlusLogIn(gPlusId);
} else {