Browse Source

Validation simplified

master
preyearegmi 6 years ago
parent
commit
080d9550a2
  1. BIN
      .idea/caches/build_file_checksums.ser
  2. 3
      app/src/main/java/com/gmeremit/online/gmeremittance_native/changepasswordV2/gateway/ChangePasswordV2Gateway.java
  3. 2
      app/src/main/java/com/gmeremit/online/gmeremittance_native/changepasswordV2/presenter/ChangePasswordV2InteractorInterface.java
  4. 47
      app/src/main/java/com/gmeremit/online/gmeremittance_native/changepasswordV2/presenter/ChangePasswordV2Presenter.java
  5. 6
      app/src/main/java/com/gmeremit/online/gmeremittance_native/changepasswordV2/presenter/ChangePasswordV2PresenterInterface.java
  6. 57
      app/src/main/java/com/gmeremit/online/gmeremittance_native/changepasswordV2/view/ChangePasswordV2Activity.java
  7. 30
      app/src/main/java/com/gmeremit/online/gmeremittance_native/loginV2/presenter/LoginV2Presenter.java
  8. 3
      app/src/main/java/com/gmeremit/online/gmeremittance_native/loginV2/presenter/LoginV2PresenterInterface.java
  9. 9
      app/src/main/java/com/gmeremit/online/gmeremittance_native/loginV2/view/LoginV2Activity.java
  10. 3
      app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/gateway/RegisterV2Gateway.java
  11. 2
      app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2InteractorInterface.java
  12. 44
      app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2Presenter.java
  13. 4
      app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2PresenterInterface.java
  14. 38
      app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/view/RegisterV2Activity.java

BIN
.idea/caches/build_file_checksums.ser

3
app/src/main/java/com/gmeremit/online/gmeremittance_native/changepasswordV2/gateway/ChangePasswordV2Gateway.java

@ -18,12 +18,13 @@ public class ChangePasswordV2Gateway extends PrivilegedGateway implements Change
@Override
public Observable<ChangePasswordActivityV2APIResponse> performChangePassRequest(String auth, String userId, String oldPass, String newPass) {
public Observable<ChangePasswordActivityV2APIResponse> performChangePassRequest(String auth, String userId, String oldPass, String newPass,String confirmPass) {
JsonObject jsonObject=new JsonObject();
jsonObject.addProperty("UserId",userId);
jsonObject.addProperty("OldPassword",oldPass);
jsonObject.addProperty("NewPassword",newPass);
jsonObject.addProperty("ConfirmPassword",newPass);
return HttpClientV2.getInstance().performChangePasswordV2(auth,jsonObject);
}

2
app/src/main/java/com/gmeremit/online/gmeremittance_native/changepasswordV2/presenter/ChangePasswordV2InteractorInterface.java

@ -11,6 +11,6 @@ public interface ChangePasswordV2InteractorInterface extends BaseInteractorInter
interface ChangePasswordV2GatewayInterface extends PrivilegedGatewayInterface
{
Observable<ChangePasswordActivityV2APIResponse> performChangePassRequest(String auth, String userId, String oldPass, String newPass);
Observable<ChangePasswordActivityV2APIResponse> performChangePassRequest(String auth, String userId, String oldPass, String newPass,String confirmPass);
}
}

47
app/src/main/java/com/gmeremit/online/gmeremittance_native/changepasswordV2/presenter/ChangePasswordV2Presenter.java

@ -16,9 +16,7 @@ public class ChangePasswordV2Presenter extends BasePresenter implements ChangePa
private final ChangePasswordV2PresenterInterface.ChangePasswordV2ContractInterface view;
private final ChangePasswordV2Gateway gateway;
private String currentPassword;
private String newPassword;
private String confirmPassword;
private String encCurrentPassword;
private String encNewPassword;
private String encConfirmPassword;
@ -26,9 +24,7 @@ public class ChangePasswordV2Presenter extends BasePresenter implements ChangePa
public ChangePasswordV2Presenter(ChangePasswordV2PresenterInterface.ChangePasswordV2ContractInterface view) {
this.view=view;
this.gateway=new ChangePasswordV2Gateway(this);
this.currentPassword="";
this.newPassword="";
this.confirmPassword="";
this.encCurrentPassword="";
this.encNewPassword="";
this.encConfirmPassword="";
@ -105,45 +101,24 @@ public class ChangePasswordV2Presenter extends BasePresenter implements ChangePa
boolean confirmPwdValidation=true;
boolean newPwdValidation=true;
if(currentPassword.trim().length()<1)
if(encCurrentPassword==null||encCurrentPassword.trim().length()<1)
{
this.view.setCurrentPasswordError(getStringfromStringId(R.string.password_empty_error));
currentPwdValidation= false;
}
if (!Utils.hasSpecialCharacters(newPassword)) {
this.view.setNewPasswordError(getStringfromStringId(R.string.password_symbol_required_error));
newPwdValidation= false;
}
if (!Utils.hasNumbers(newPassword)) {
this.view.setNewPasswordError(getStringfromStringId(R.string.password_number_required_error));
newPwdValidation= false;
}
if (newPassword.length()>1&&newPassword.length()<9) {
this.view.setNewPasswordError(getStringfromStringId(R.string.password_length_error));
newPwdValidation= false;
}
if (!Utils.hasAtleastOnCapitalLetter(newPassword)) {
this.view.setNewPasswordError(getStringfromStringId(R.string.password_capital_letter_required_error));
newPwdValidation= false;
}
if(newPassword.trim().length()<1)
if(encNewPassword==null||encNewPassword.trim().length()<1)
{
this.view.setNewPasswordError(getStringfromStringId(R.string.password_empty_error));
newPwdValidation= false;
}
if (!newPassword.equals(confirmPassword)) {
this.view.setConfirmPasswordError(getStringfromStringId(R.string.confirm_password_mismatch_error));
confirmPwdValidation= false;
}
if(confirmPassword==null||confirmPassword.trim().length()<1)
if(encConfirmPassword==null||encConfirmPassword.trim().length()<1)
{
this.view.setConfirmPasswordError(getStringfromStringId(R.string.confirm_passowrd_empty_error));
confirmPwdValidation= false;
}
if(currentPwdValidation) {
view.setCurrentPasswordError(null);
}
@ -156,7 +131,6 @@ public class ChangePasswordV2Presenter extends BasePresenter implements ChangePa
if(newPwdValidation)
{
view.setNewPasswordError(null);
}
return currentPwdValidation&&confirmPwdValidation&&newPwdValidation;
@ -165,7 +139,7 @@ public class ChangePasswordV2Presenter extends BasePresenter implements ChangePa
@Override
public void changePassword(String currentPass, String newPass) {
this.gateway.performChangePassRequest(this.gateway.getAuth(),this.gateway.getUserID(),this.currentPassword,this.newPassword)
this.gateway.performChangePassRequest(this.gateway.getAuth(),this.gateway.getUserID(),this.encCurrentPassword,this.encNewPassword,this.encConfirmPassword)
.doOnSubscribe(d->view.showProgressBar(true,"Changing password..."))
.doFinally(()->view.showProgressBar(false,""))
.subscribeOn(Schedulers.io())
@ -174,21 +148,18 @@ public class ChangePasswordV2Presenter extends BasePresenter implements ChangePa
}
@Override
public void updateCurrentPassword(String encCurrentPassword, String currentPassword) {
public void updateCurrentPassword(String encCurrentPassword) {
this.encCurrentPassword=encCurrentPassword;
this.currentPassword=currentPassword;
}
@Override
public void updateNewPassword(String encNewPassword,String newPassword) {
public void updateNewPassword(String encNewPassword) {
this.encNewPassword=encNewPassword;
this.newPassword=newPassword;
}
@Override
public void updateConfirmPassword(String encConfirmPassword, String confirmPassword) {
public void updateConfirmPassword(String encConfirmPassword) {
this.encConfirmPassword=encConfirmPassword;
this.confirmPassword=confirmPassword;
}

6
app/src/main/java/com/gmeremit/online/gmeremittance_native/changepasswordV2/presenter/ChangePasswordV2PresenterInterface.java

@ -13,11 +13,11 @@ public interface ChangePasswordV2PresenterInterface extends BasePresenterInterfa
void changePassword(String currentPass,String newPass);
void updateCurrentPassword(String encCurrentPassword,String currentPassword);
void updateCurrentPassword(String encCurrentPassword);
void updateNewPassword(String encNewPassword, String newPassword);
void updateNewPassword(String encNewPassword);
void updateConfirmPassword(String encConfirmPassword, String confirmPassword);
void updateConfirmPassword(String encConfirmPassword);
interface ChangePasswordV2ContractInterface extends BaseContractInterface
{

57
app/src/main/java/com/gmeremit/online/gmeremittance_native/changepasswordV2/view/ChangePasswordV2Activity.java

@ -13,6 +13,7 @@ import android.widget.TextView;
import com.gmeremit.online.gmeremittance_native.R;
import com.gmeremit.online.gmeremittance_native.base.BaseActivity;
import com.gmeremit.online.gmeremittance_native.changepasswordV2.presenter.ChangePasswordV2InteractorInterface;
import com.gmeremit.online.gmeremittance_native.changepasswordV2.presenter.ChangePasswordV2Presenter;
import com.gmeremit.online.gmeremittance_native.changepasswordV2.presenter.ChangePasswordV2PresenterInterface;
import com.gmeremit.online.gmeremittance_native.customwidgets.GmeErrorTextView;
@ -81,7 +82,7 @@ public class ChangePasswordV2Activity extends BaseActivity implements ChangePass
View rootView;
private ChangePasswordV2Presenter presenter;
private ChangePasswordV2PresenterInterface presenter;
SecurityKeyboardManager securityKeyboardCurrentPasswordManager;
@ -248,25 +249,12 @@ public class ChangePasswordV2Activity extends BaseActivity implements ChangePass
class SecurityKeypadCurrentPasswordListener implements SecurityKeyboardManager.SecurityKeyboardActionListenerFacade,SecurityKeyboardView.SecurityKeyboardFocusStateListener {
@Override
public void done(Intent intent) {
presenter.updateCurrentPassword(intent.getStringExtra(TransKeyActivity.mTK_PARAM_CIPHER_DATA),getDecryptedDataFromIntent(intent));
presenter.updateCurrentPassword(intent.getStringExtra(TransKeyActivity.mTK_PARAM_SECURE_DATA));
}
@Override
public void cancel(Intent intent) {
presenter.updateCurrentPassword(intent.getStringExtra(TransKeyActivity.mTK_PARAM_CIPHER_DATA),getDecryptedDataFromIntent(intent));
}
private String getDecryptedDataFromIntent(Intent intent)
{
if (intent == null)
return "";
String cipherData = intent.getStringExtra(TransKeyActivity.mTK_PARAM_CIPHER_DATA);
byte[] secureKey = intent.getByteArrayExtra(TransKeyActivity.mTK_PARAM_SECURE_KEY);
int iRealDataLength = intent.getIntExtra(TransKeyActivity.mTK_PARAM_DATA_LENGTH, 0);
return EncryptionManager.decryptCipherText(cipherData,secureKey,iRealDataLength);
presenter.updateCurrentPassword(intent.getStringExtra(TransKeyActivity.mTK_PARAM_SECURE_DATA));
}
@ -318,29 +306,14 @@ public class ChangePasswordV2Activity extends BaseActivity implements ChangePass
class SecurityKeypadNewPasswordListener implements SecurityKeyboardManager.SecurityKeyboardActionListenerFacade,SecurityKeyboardView.SecurityKeyboardFocusStateListener {
@Override
public void done(Intent intent) {
presenter.updateNewPassword(intent.getStringExtra(TransKeyActivity.mTK_PARAM_CIPHER_DATA),getDecryptedDataFromIntent(intent));
presenter.updateNewPassword(intent.getStringExtra(TransKeyActivity.mTK_PARAM_SECURE_DATA));
}
@Override
public void cancel(Intent intent) {
presenter.updateNewPassword(intent.getStringExtra(TransKeyActivity.mTK_PARAM_CIPHER_DATA),getDecryptedDataFromIntent(intent));
}
private String getDecryptedDataFromIntent(Intent intent)
{
if (intent == null)
return "";
String cipherData = intent.getStringExtra(TransKeyActivity.mTK_PARAM_CIPHER_DATA);
byte[] secureKey = intent.getByteArrayExtra(TransKeyActivity.mTK_PARAM_SECURE_KEY);
int iRealDataLength = intent.getIntExtra(TransKeyActivity.mTK_PARAM_DATA_LENGTH, 0);
Log.d("EncryptedData",cipherData);
return EncryptionManager.decryptCipherText(cipherData,secureKey,iRealDataLength);
presenter.updateNewPassword(intent.getStringExtra(TransKeyActivity.mTK_PARAM_SECURE_DATA));
}
@Override
public void input(int i) {
@ -390,29 +363,15 @@ public class ChangePasswordV2Activity extends BaseActivity implements ChangePass
class SecurityKeypadConfirmPasswordListener implements SecurityKeyboardManager.SecurityKeyboardActionListenerFacade,SecurityKeyboardView.SecurityKeyboardFocusStateListener {
@Override
public void done(Intent intent) {
presenter.updateConfirmPassword(intent.getStringExtra(TransKeyActivity.mTK_PARAM_CIPHER_DATA),getDecryptedDataFromIntent(intent));
presenter.updateConfirmPassword(intent.getStringExtra(TransKeyActivity.mTK_PARAM_SECURE_DATA));
}
@Override
public void cancel(Intent intent) {
presenter.updateConfirmPassword(intent.getStringExtra(TransKeyActivity.mTK_PARAM_CIPHER_DATA),getDecryptedDataFromIntent(intent));
}
presenter.updateConfirmPassword(intent.getStringExtra(TransKeyActivity.mTK_PARAM_SECURE_DATA));
private String getDecryptedDataFromIntent(Intent intent)
{
if (intent == null)
return "";
String cipherData = intent.getStringExtra(TransKeyActivity.mTK_PARAM_CIPHER_DATA);
byte[] secureKey = intent.getByteArrayExtra(TransKeyActivity.mTK_PARAM_SECURE_KEY);
int iRealDataLength = intent.getIntExtra(TransKeyActivity.mTK_PARAM_DATA_LENGTH, 0);
return EncryptionManager.decryptCipherText(cipherData,secureKey,iRealDataLength);
}
@Override
public void input(int i) {

30
app/src/main/java/com/gmeremit/online/gmeremittance_native/loginV2/presenter/LoginV2Presenter.java

@ -9,11 +9,8 @@ import com.gmeremit.online.gmeremittance_native.utils.Constants;
import com.gmeremit.online.gmeremittance_native.utils.Utils;
import com.gmeremit.online.gmeremittance_native.utils.https.GenericApiObserverResponse;
import java.util.logging.Handler;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
public class LoginV2Presenter extends BasePresenter implements LoginV2PresenterInterface, LoginV2InteractorInterface {
@ -21,13 +18,13 @@ public class LoginV2Presenter extends BasePresenter implements LoginV2PresenterI
private final LoginV2ContractInterface view;
private final LoginV2Gateway gateway;
private String userPassword;
private String encUserPassword;
public LoginV2Presenter(LoginV2ContractInterface view) {
this.view=view;
this.gateway=new LoginV2Gateway(this);
userPassword="";
encUserPassword ="";
}
@ -43,17 +40,8 @@ public class LoginV2Presenter extends BasePresenter implements LoginV2PresenterI
}
}
@Override
public boolean validatePassword(String s) {
// if(s.length()<1) {
// view.showInvalidPassword("Password cannot be empty.");
// return false;
// }
// else {
// view.showInvalidPassword(null);
// return true;
// }
if(userPassword.length()<1) {
private boolean validatePassword() {
if(encUserPassword.length()<1) {
view.showInvalidPassword("Password cannot be empty.");
return false;
}
@ -64,15 +52,15 @@ public class LoginV2Presenter extends BasePresenter implements LoginV2PresenterI
}
@Override
public void updateUserPassword(String decryptedDataFromIntent) {
this.userPassword=decryptedDataFromIntent;
public void updateUserPassword(String encryptedPassword) {
this.encUserPassword =encryptedPassword;
}
@Override
public void loginUser(String userId, String userPwd) {
String auth= "Basic "+Utils.toBase64("172017F9EC11222E8107142733:QRK2UM0Q:" + GmeApplication.getAppRelatedMetaData().getDeviceId());
this.gateway.loginUser(auth,userId,userPassword)
this.gateway.loginUser(auth,userId, encUserPassword)
// .doOnSubscribe(d->view.showProgressBar(true,"Logging in..."))
// .doFinally(()->view.showProgressBar(false,""))
.subscribeOn(Schedulers.io())
@ -94,9 +82,9 @@ public class LoginV2Presenter extends BasePresenter implements LoginV2PresenterI
}
@Override
public boolean validateAll(String userId, String password) {
public boolean validateAll(String userId) {
boolean result1=validateUserId(userId);
boolean result2 =validatePassword(password);
boolean result2 =validatePassword();
return result1&&result2;
}

3
app/src/main/java/com/gmeremit/online/gmeremittance_native/loginV2/presenter/LoginV2PresenterInterface.java

@ -15,9 +15,8 @@ public interface LoginV2PresenterInterface extends BasePresenterInterface {
void loginUser(String userId, String userPwd);
boolean validateAll(String userId, String password);
boolean validateAll(String userId);
boolean validateUserId(String userId);
boolean validatePassword(String s);
void updateUserPassword(String decryptedDataFromIntent);

9
app/src/main/java/com/gmeremit/online/gmeremittance_native/loginV2/view/LoginV2Activity.java

@ -200,7 +200,7 @@ public class LoginV2Activity extends BaseActivity implements View.OnClickListene
private void onLoginBtn()
{
if (presenter.validateAll(usernameId.getText().toString(),"")){
if (presenter.validateAll(usernameId.getText().toString())){
hideKeyBoard();
rootView.clearFocus();
morphButtonIntoProgressBar();
@ -362,14 +362,15 @@ public class LoginV2Activity extends BaseActivity implements View.OnClickListene
class SecurityKeypadListener implements SecurityKeyboardManager.SecurityKeyboardActionListenerFacade {
@Override
public void done(Intent intent) {
presenter.updateUserPassword(getDecryptedDataFromIntent(intent));
String encryptedText = intent.getStringExtra(TransKeyActivity.mTK_PARAM_SECURE_DATA);
presenter.updateUserPassword(encryptedText);
onLoginBtn();
}
@Override
public void cancel(Intent intent) {
presenter.updateUserPassword(getDecryptedDataFromIntent(intent));
}
String encryptedText = intent.getStringExtra(TransKeyActivity.mTK_PARAM_SECURE_DATA);
presenter.updateUserPassword(encryptedText); }
private String getDecryptedDataFromIntent(Intent intent)

3
app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/gateway/RegisterV2Gateway.java

@ -27,12 +27,13 @@ public class RegisterV2Gateway extends PrivilegedGateway implements RegisterV2In
}
@Override
public Observable<RegisterApiResponse> registerUser(String auth, String userName, String password,String dob, String clientId, String fcmId, String appVersion, String phoneBrand, String phoneOs, String deviceId, String osVersion) {
public Observable<RegisterApiResponse> registerUser(String auth, String userName, String password,String confirmPassword, String dob, String clientId, String fcmId, String appVersion, String phoneBrand, String phoneOs, String deviceId, String osVersion) {
JsonObject jsonObject=new JsonObject();
jsonObject.addProperty("username",userName);
jsonObject.addProperty("password",password);
jsonObject.addProperty("confirmPassword",password);
jsonObject.addProperty("dob",dob);
jsonObject.addProperty("clientId",clientId);
jsonObject.addProperty("uuid",deviceId);

2
app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2InteractorInterface.java

@ -15,7 +15,7 @@ public interface RegisterV2InteractorInterface extends BaseInteractorInterface {
interface Register2GatewayInterface extends PrivilegedGatewayInterface
{
Observable<RegisterApiResponse> registerUser(String auth, String userName, String password,String dob, String clientId, String fcmId, String appVersion, String phoneBrand, String phoneOs, String deviceId, String osVersion);
Observable<RegisterApiResponse> registerUser(String auth, String userName, String password,String confirmPassword, String dob, String clientId, String fcmId, String appVersion, String phoneBrand, String phoneOs, String deviceId, String osVersion);
void updateUserId(String userId);
}

44
app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2Presenter.java

@ -23,8 +23,7 @@ public class RegisterV2Presenter extends BasePresenter implements RegisterV2Pres
private final RegisterV2ContractInterface view;
private CompositeDisposable compositeDisposable;
private String password;
private String confirmPassword;
private String encPassword;
private String encConfirmPassword;
@ -32,8 +31,6 @@ public class RegisterV2Presenter extends BasePresenter implements RegisterV2Pres
this.view = view;
compositeDisposable=new CompositeDisposable();
this.gateway = new RegisterV2Gateway(this);
password="";
confirmPassword="";
encPassword="";
encConfirmPassword="";
}
@ -88,40 +85,23 @@ public class RegisterV2Presenter extends BasePresenter implements RegisterV2Pres
return pwdValidation&&confirmPwdValidation;
}
/**
* Validation removed after implementing security keypad
* @return
*/
@Override
public boolean validatePasswords()
{
boolean pwdValidation=true;
boolean confirmPwdValidation=true;
if (!Utils.hasSpecialCharacters(password)) {
this.view.setPasswordError("Password should have at least one symbol");
pwdValidation= false;
}
if (!Utils.hasNumbers(password)) {
this.view.setPasswordError("Password should have at least one number");
pwdValidation= false;
}
if (password.length()>1&&password.length()<9) {
this.view.setPasswordError("Password should have at least 9 characters");
pwdValidation= false;
}
if (!Utils.hasAtleastOnCapitalLetter(password)) {
this.view.setPasswordError("Password should have at least one capital letter");
pwdValidation= false;
}
if(password.trim().length()<1)
if(encPassword==null||encPassword.trim().length()<1)
{
this.view.setPasswordError("Password cannot be empty");
pwdValidation= false;
}
if (!password.equals(confirmPassword)) {
this.view.setConfirmPasswordError("Passwords does not match");
confirmPwdValidation= false;
}
if(confirmPassword==null||confirmPassword.trim().length()<1)
if(encConfirmPassword==null||encConfirmPassword.trim().length()<1)
{
this.view.setConfirmPasswordError("Confirm password cannot be empty");
confirmPwdValidation= false;
@ -134,6 +114,7 @@ public class RegisterV2Presenter extends BasePresenter implements RegisterV2Pres
view.setConfirmPasswordError(null);
}
return pwdValidation&&confirmPwdValidation;
}
@ -154,7 +135,8 @@ public class RegisterV2Presenter extends BasePresenter implements RegisterV2Pres
this.gateway.registerUser(
auth,
userId,
this.password,
this.encPassword,
this.encConfirmPassword,
dob,
"172017F9EC11222E8107142733",
fcmID,
@ -211,15 +193,13 @@ public class RegisterV2Presenter extends BasePresenter implements RegisterV2Pres
}
@Override
public void updatePassword(String encUpdatedPassword, String updatedPassword) {
public void updatePassword(String encUpdatedPassword) {
this.encPassword=encUpdatedPassword;
this.password=updatedPassword;
}
@Override
public void updateConfirmPassword(String encConfirmPassword, String confirmPassword) {
public void updateConfirmPassword(String encConfirmPassword) {
this.encConfirmPassword=encConfirmPassword;
this.confirmPassword=confirmPassword;
}
@Override

4
app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2PresenterInterface.java

@ -17,9 +17,9 @@ public interface RegisterV2PresenterInterface extends BasePresenterInterface {
boolean validateAll(String emailId,String dobString);
void updatePassword(String encUpdatedPassword, String updatedPassword);
void updatePassword(String encUpdatedPassword);
void updateConfirmPassword(String encConfirmPassword, String confirmPassword);
void updateConfirmPassword(String encConfirmPassword);
boolean validatePasswords();

38
app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/view/RegisterV2Activity.java

@ -328,31 +328,15 @@ public class RegisterV2Activity extends BaseActivity implements RegisterV2Presen
@Override
public void done(Intent intent) {
String encryptedText = intent.getStringExtra(TransKeyActivity.mTK_PARAM_SECURE_DATA);
Log.d("RegisterScreen", encryptedText);
presenter.updatePassword(intent.getStringExtra(encryptedText), getDecryptedDataFromIntent(intent));
presenter.updatePassword(encryptedText);
}
@Override
public void cancel(Intent intent) {
String encryptedText = intent.getStringExtra(TransKeyActivity.mTK_PARAM_SECURE_DATA);
Log.d("RegisterScreen", encryptedText);
presenter.updatePassword(encryptedText, getDecryptedDataFromIntent(intent));
presenter.updatePassword(encryptedText);
}
private String getDecryptedDataFromIntent(Intent intent) {
if (intent == null)
return "";
String cipherData = intent.getStringExtra(TransKeyActivity.mTK_PARAM_CIPHER_DATA);
byte[] secureKey = intent.getByteArrayExtra(TransKeyActivity.mTK_PARAM_SECURE_KEY);
int iRealDataLength = intent.getIntExtra(TransKeyActivity.mTK_PARAM_DATA_LENGTH, 0);
Log.d("EncryptedData", cipherData);
return EncryptionManager.decryptCipherText(cipherData, secureKey, iRealDataLength);
}
@Override
public void input(int i) {
@ -402,28 +386,14 @@ public class RegisterV2Activity extends BaseActivity implements RegisterV2Presen
@Override
public void done(Intent intent) {
String encryptedText = intent.getStringExtra(TransKeyActivity.mTK_PARAM_SECURE_DATA);
Log.d("RegisterScreen", encryptedText);
presenter.updateConfirmPassword(encryptedText, getDecryptedDataFromIntent(intent));
presenter.updateConfirmPassword(encryptedText);
}
@Override
public void cancel(Intent intent) {
String encryptedText = intent.getStringExtra(TransKeyActivity.mTK_PARAM_SECURE_DATA);
Log.d("RegisterScreen", encryptedText);
presenter.updateConfirmPassword(encryptedText, getDecryptedDataFromIntent(intent));
}
private String getDecryptedDataFromIntent(Intent intent) {
if (intent == null)
return "";
String cipherData = intent.getStringExtra(TransKeyActivity.mTK_PARAM_CIPHER_DATA);
presenter.updateConfirmPassword(encryptedText);
byte[] secureKey = intent.getByteArrayExtra(TransKeyActivity.mTK_PARAM_SECURE_KEY);
int iRealDataLength = intent.getIntExtra(TransKeyActivity.mTK_PARAM_DATA_LENGTH, 0);
return EncryptionManager.decryptCipherText(cipherData, secureKey, iRealDataLength);
}

Loading…
Cancel
Save