Added xmlrpc method to recover username associated to email
This commit is contained in:
parent
2025fb3b1b
commit
826cdc7e27
3 changed files with 66 additions and 2 deletions
|
@ -548,7 +548,7 @@ public class XmlRpcHelper {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(long id, Object object) {
|
public void onResponse(long id, Object object) {
|
||||||
String result = (String)object;
|
String result = (String)object;
|
||||||
Log.d("changeAccountPasswordAsync: " + result);
|
Log.d("changeAccountHashPasswordAsync: " + result);
|
||||||
|
|
||||||
if (result.startsWith("ERROR_")) {
|
if (result.startsWith("ERROR_")) {
|
||||||
Log.e(result);
|
Log.e(result);
|
||||||
|
@ -576,7 +576,7 @@ public class XmlRpcHelper {
|
||||||
try {
|
try {
|
||||||
Object object = mXmlRpcClient.call("change_hash", username, oldPassword, newPassword);
|
Object object = mXmlRpcClient.call("change_hash", username, oldPassword, newPassword);
|
||||||
String result = (String)object;
|
String result = (String)object;
|
||||||
Log.d("changeAccountPassword: " + result);
|
Log.d("changeAccountHashPassword: " + result);
|
||||||
|
|
||||||
if (result.startsWith("ERROR_")) {
|
if (result.startsWith("ERROR_")) {
|
||||||
Log.e(result);
|
Log.e(result);
|
||||||
|
@ -707,6 +707,63 @@ public class XmlRpcHelper {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendUsernameByEmailAsync(final XmlRpcListener listener, String email) {
|
||||||
|
if (mXmlRpcClient != null) {
|
||||||
|
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
||||||
|
@Override
|
||||||
|
public void onServerError(long id, XMLRPCServerException error) {
|
||||||
|
Log.e(error);
|
||||||
|
listener.onError(error.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(long id, Object object) {
|
||||||
|
String result = (String)object;
|
||||||
|
Log.d("sendUsernameByEmailAsync: " + result);
|
||||||
|
|
||||||
|
if (result.startsWith("ERROR_")) {
|
||||||
|
Log.e(result);
|
||||||
|
listener.onError(result);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
listener.onUsernameSent(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(long id, XMLRPCException error) {
|
||||||
|
Log.e(error);
|
||||||
|
listener.onError(error.toString());
|
||||||
|
}
|
||||||
|
}, "recover_username_from_email", email);
|
||||||
|
} else {
|
||||||
|
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||||
|
listener.onError(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String sendUsernameByEmail(String email) {
|
||||||
|
if (mXmlRpcClient != null) {
|
||||||
|
try {
|
||||||
|
Object object = mXmlRpcClient.call("recover_username_from_email", email);
|
||||||
|
String result = (String)object;
|
||||||
|
Log.d("sendUsernameByEmail: " + result);
|
||||||
|
|
||||||
|
if (result.startsWith("ERROR_")) {
|
||||||
|
Log.e(result);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
|
||||||
|
} catch (XMLRPCException e) {
|
||||||
|
Log.e(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void verifySignatureAsync(final XmlRpcListener listener, String payload, String signature) {
|
public void verifySignatureAsync(final XmlRpcListener listener, String payload, String signature) {
|
||||||
if (mXmlRpcClient != null) {
|
if (mXmlRpcClient != null) {
|
||||||
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
||||||
|
|
|
@ -14,4 +14,5 @@ public interface XmlRpcListener {
|
||||||
public void onRecoverPasswordLinkSent(String result);
|
public void onRecoverPasswordLinkSent(String result);
|
||||||
public void onActivateAccountLinkSent(String result);
|
public void onActivateAccountLinkSent(String result);
|
||||||
public void onSignatureVerified(boolean success);
|
public void onSignatureVerified(boolean success);
|
||||||
|
public void onUsernameSent(String result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,4 +78,10 @@ public class XmlRpcListenerBase implements XmlRpcListener {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUsernameSent(String result) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue