// initialize parameters, recover the password
String sUsername = getRecoverPasswordCriteria().getUsername();
String sEmail = getRecoverPasswordCriteria().getEmailAddress();
IdentityAdapter idAdapter = context.newIdentityAdapter();
User user = idAdapter.recoverPassword(getRecoverPasswordCriteria());
if (user != null) {
// get the new password
UsernamePasswordCredentials upCred;
upCred = user.getCredentials().getUsernamePasswordCredentials();