From dc3ce32b4aa802ba789102d4c54e5d5c070d82ee Mon Sep 17 00:00:00 2001 From: Carlos Sotelo Date: Thu, 28 Feb 2019 15:32:15 +0000 Subject: [PATCH 1/4] Removing pattern/passkey validation --- src/android/secureDevice.java | 2 +- src/ios/secureDevice.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/android/secureDevice.java b/src/android/secureDevice.java index 2b2915b..7cbc26d 100644 --- a/src/android/secureDevice.java +++ b/src/android/secureDevice.java @@ -63,7 +63,7 @@ private void checkDevice() { boolean _isDeviceRooted = isDeviceRooted(); boolean _isPasscodeSet = doesDeviceHaveSecuritySetup(this.cordova.getActivity()); - if (_isDeviceRooted || !_isPasscodeSet) { + if (_isDeviceRooted) { // Remove View View v = this.view.getView(); if (v != null) { diff --git a/src/ios/secureDevice.m b/src/ios/secureDevice.m index 97c49f5..2798683 100644 --- a/src/ios/secureDevice.m +++ b/src/ios/secureDevice.m @@ -41,7 +41,7 @@ - (void) checkDevice BOOL jailbroken = [UIDevice currentDevice].isJB; LNPasscodeStatus status = [UIDevice currentDevice].passcodeStatus; - if (jailbroken || status == LNPasscodeStatusDisabled || status == LNPasscodeStatusUnknown) { + if (jailbroken) { NSString* alertMessage = @"This application does not run on a device that is rooted."; NSString* customAlertCloseButtonText = [self.commandDelegate.settings objectForKey:@"secureplugindialogcloselabel"]; From 9a6030734f89870c4b35fb6fd2a4c0459d131cc9 Mon Sep 17 00:00:00 2001 From: Carlos Sotelo Date: Thu, 28 Feb 2019 16:06:52 +0000 Subject: [PATCH 2/4] Bumping version to 2.0.1 Adding preference CheckPattern to disable/enable the validation of the pattern --- README.md | 9 +++++++++ package.json | 2 +- plugin.xml | 2 +- src/android/secureDevice.java | 7 ++++--- src/ios/secureDevice.m | 5 +++-- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2382984..81f650c 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,15 @@ On your application config.xml file set one, or all, of the following preference ``` + +### Customizing behavior +The plugin default behavior checks if the phone has a password,pin or pattern defined. To deactivate this, change the preference `CheckPattern`. +On your application config.xml file set one, or all, of the following preferences: + +```xml + +``` + ## License ``` diff --git a/package.json b/package.json index 1711988..6d53072 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "outsystems-secure-device", - "version": "2.0.0.os", + "version": "2.0.1", "description": "Stops app from running if device is not secure, i.e. it is jailbroken, rooted, or doesn't have a passcode set.", "cordova": { "id": "outsystems-secure-device", diff --git a/plugin.xml b/plugin.xml index 4945198..2d6d23b 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,5 +1,5 @@ - + secureDevice Stops app from running if device is not secure, i.e. it is jailbroken, rooted, or doesn't have a passcode set. André Vieira diff --git a/src/android/secureDevice.java b/src/android/secureDevice.java index 7cbc26d..d47d325 100644 --- a/src/android/secureDevice.java +++ b/src/android/secureDevice.java @@ -17,7 +17,6 @@ package com.outsystemscloud.andrevieira; import android.annotation.SuppressLint; -import android.app.Activity; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.app.KeyguardManager; @@ -42,6 +41,7 @@ public class secureDevice extends CordovaPlugin { public static final String DIALOG_CLOSE_LABEL = "SecurePluginDialogCloseLabel"; public static final String ROOTED_DEVICE_STRING = "SecurePluginRootedDeviceString"; public static final String NO_LOCK_DEVICE_STRING = "SecurePluginNoLockSafetyString"; + public static final String CHECK_PATTERN = "CheckPattern"; CordovaInterface cordova; CordovaWebView view; @@ -62,8 +62,9 @@ public void onResume(boolean multiTasking) { private void checkDevice() { boolean _isDeviceRooted = isDeviceRooted(); boolean _isPasscodeSet = doesDeviceHaveSecuritySetup(this.cordova.getActivity()); + boolean _checkPattern = this.preferences.getBoolean(CHECK_PATTERN, true); - if (_isDeviceRooted) { + if (_isDeviceRooted || (_checkPattern && !_isPasscodeSet)) { // Remove View View v = this.view.getView(); if (v != null) { @@ -170,7 +171,7 @@ private static boolean isPassOrPinSet(Context context) { */ private synchronized void alert(final String message, final String buttonLabel) { final CordovaInterface cordova = this.cordova; - + Runnable runnable = new Runnable() { public void run() { diff --git a/src/ios/secureDevice.m b/src/ios/secureDevice.m index 2798683..11c9ce1 100644 --- a/src/ios/secureDevice.m +++ b/src/ios/secureDevice.m @@ -40,8 +40,9 @@ - (void) checkDevice { BOOL jailbroken = [UIDevice currentDevice].isJB; LNPasscodeStatus status = [UIDevice currentDevice].passcodeStatus; - - if (jailbroken) { + BOOL checkPattern = ![(NSString* )[self.commandDelegate.settings objectForKey:@"checkpattern"] isEqualToString:@"false"]; + + if (jailbroken || ( checkPattern && (status == LNPasscodeStatusDisabled || status == LNPasscodeStatusUnknown))) { NSString* alertMessage = @"This application does not run on a device that is rooted."; NSString* customAlertCloseButtonText = [self.commandDelegate.settings objectForKey:@"secureplugindialogcloselabel"]; From 6fc8e3e8203833b8fd45dced550b14e16e71cbe2 Mon Sep 17 00:00:00 2001 From: Carlos Sotelo Date: Mon, 4 Mar 2019 16:12:52 +0000 Subject: [PATCH 3/4] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6d53072..96e212e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "outsystems-secure-device", - "version": "2.0.1", + "version": "2.0.0-os2", "description": "Stops app from running if device is not secure, i.e. it is jailbroken, rooted, or doesn't have a passcode set.", "cordova": { "id": "outsystems-secure-device", From b4ab8bc5a109200db5e89af8704ecef7544cbdc3 Mon Sep 17 00:00:00 2001 From: Carlos Sotelo Date: Mon, 4 Mar 2019 16:13:16 +0000 Subject: [PATCH 4/4] Update plugin.xml --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index 2d6d23b..e317fe7 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,5 +1,5 @@ - + secureDevice Stops app from running if device is not secure, i.e. it is jailbroken, rooted, or doesn't have a passcode set. André Vieira