@Override
public UserIndex completePhoneNumberRegistration(UserIndex userIndex,
String registrationCode) {
UserRegistration registration = _userIndexRegistrationService.getRegistrationForUserIndexKey(userIndex.getId());
if (registration == null)
return null;
String expectedCode = registration.getRegistrationCode();
if (!expectedCode.equals(registrationCode))
return null;
/**
* At this point, we have a valid registration code. We may safely clear the
* registration
*/
_userIndexRegistrationService.clearRegistrationForUserIndexKey(userIndex.getId());
User targetUser = _userDao.getUserForId(registration.getUserId());
if (targetUser == null)
return null;
User phoneUser = userIndex.getUser();