Git Product home page Git Product logo

passcodelock-android's Introduction


Not Maintained!
This project is no longer being actively maintained. Use at your own risk!


App passcode library for Android

An app passcode protection implementation, which allows user to protect the app with a four digit code.

Once enabled a four-digit passcode needs to be entered any time your mobile app is launched. This way your app is safe even if your smartphone or tablet falls into the wrong hands.

Note: This library doesn't add any extra protection to your data. App data will not be encrypted, the library just adds a pin lock screen that makes the app safe even if your kids put their hands on the device :)

Example Usage

Add it as a maven dependency in your build.gradle file. PasscodeLock is hosted on the maven central repository.

  • In your build.gradle:
dependencies {
    // use the latest 1.x version
    compile 'org.wordpress:passcodelock:1.+'
}
  • Edit your AndroidManifest.xml and declare the following activities:
<activity
    android:name="org.wordpress.passcodelock.PasscodeUnlockActivity"
    android:theme="@style/Theme.Sherlock.Light.NoActionBar"
    android:windowSoftInputMode="stateHidden" >
</activity>
<activity
    android:name="org.wordpress.passcodelock.PasscodeManagePasswordActivity"
    android:theme="@style/Theme.Sherlock.Light.NoActionBar"
    android:windowSoftInputMode="stateHidden" >
</activity>
  • Add the following line in onCreate of your App file:
AppLockManager.getInstance().enableDefaultAppLockIfAvailable(this);

Customization

If you want to customize the pinlock icon, the one available in the unlock screen, override the passcode_logo.xml drawable resource.

Hack the library

  • Copy gradle.properties-example to gradle.properties in the library/ directory of the project.

Publish it to bintray:

$ ./gradlew assemble publishToMavenLocal bintrayUpload -PbintrayUser=FIXME -PbintrayKey=FIXME -PdryRun=false

Apps that use this library

License

Dual licensed under MIT, and GPL.

passcodelock-android's People

Contributors

anitaa1990 avatar beaucollins avatar daniloercoli avatar kwonye avatar matboehmer avatar maxme avatar mchowning avatar mzorz avatar nbradbury avatar roundhill avatar theck13 avatar tonyr59h avatar tunous avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

passcodelock-android's Issues

Infinite failed PIN lock attempts

Originally reported at: Automattic/simplenote-android#427

Not sure if this is intended but failing to enter the correct PIN lock code allows you to keep trying an infinite (tested up to 34 on my end) number of times

Steps to reproduce:

Launch Simplenote.
Activate the PIN lock feature under Settings > Turn PIN lock On.
Add a 4 digit passcode, for instance 1234.
Close the app and relaunch.
Enter a wrong passcode.
Keep entering the wrong passcode.
What would I expect?
As you get stuck in the unlock screen and there's no message for the user on how to workaround that or access to their notes, I'd suggest a message after 3 failed attempts on the lines of

"Have you lost access to Simplenote? You can regain access by re-installing the app and logging into your account."
As reinstalling the app would request your email and password in order to log in, that should be alright and at the same time there's an effective way to get out of the loop of not being able to access to your account and not getting a message on how to solve that.

PIN Input Screen Not Shown for Pre-Lollipop Devices

Expected

On a pre-Lollipop device (API < 21), enabling the passcode lock by switching on the Enable lock option in Settings displays the PIN input screen.

Observed

On a pre-Lollipop device (API < 21), nothing is displayed when enabling the passcode lock option. The Settings screen remains.

Reproduced

  1. Tap _Settings_ icon.
  2. Tap _Enable lock_ option in _Settings_.

Tested

Nexus 5 on Android 4.4.2 with PasscodeLock Sample 1.0
Samsung Galaxy S III on Android 4.4.4 with PasscodeLock Sample 1.0
Samsung Galaxy Tab 3 on Android 4.4.2 with PasscodeLock Sample 1.0

ClassCastException Error

 java.lang.ClassCastException: android.preference.PreferenceCategory cannot be cast to android.preference.PreferenceScreen
            at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:276)
            at android.preference.PreferenceFragment.addPreferencesFromResource(PreferenceFragment.java:310)
            at org.wordpress.passcodelock.PasscodePreferenceFragment.onCreate(PasscodePreferenceFragment.java:25)
            at android.app.Fragment.performCreate(Fragment.java:1678)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:859)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
            at android.app.BackStackRecord.run(BackStackRecord.java:698)
            at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1447)
            at android.app.FragmentManagerImpl$1.run(FragmentManager.java:443)
            at android.os.Handler.handleCallback(Handler.java:808)
            at android.os.Handler.dispatchMessage(Handler.java:103)
            at android.os.Looper.loop(Looper.java:193)
            at android.app.ActivityThread.main(ActivityThread.java:5299)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
            at dalvik.system.NativeStart.main(Native Method)

Improve lock options

Suggested behavior

Three settings options for the app to relock:

  • Lock app at device screen off
  • Lock app after screen of for... minutes
  • Enter password once to unlock app

Came in through HS: 112091-h

Material Design

It'd be nice to update the settings and unlock screen to follow the material design guidelines.

Interactions Differ between Manage and Unlock

Expected

When an incorrect pin is entered, the "Wrong PIN" toast message is displayed and the screen shakes.

Observed

When an incorrect pin is entered, the "Wrong PIN" toast message is displayed. While attempting to unlock, the screen shakes also. While attempting to change or turn off pin lock, the screen does not shake.

Reproduced

Change PIN

  1. Go to User > App > App Settings > Turn PIN lock on.
  2. Enter a PIN.
  3. Go to User > App > App Settings > Change PIN.
  4. Enter an incorrect PIN.

Turn Off PIN Lock

  1. Go to User > App > App Settings > Turn PIN lock off.
  2. Enter an incorrect PIN.

Unlock

  1. Exit the app.
  2. Swipe away WordPress from recents app list.
  3. Open the WordPress app.
  4. Enter an incorrect PIN.
Tested

LG G4 on Android 6.0.1 with WordPress 5.4-alpha-9
HTC Nexus 9 on Android 6.0.1 with WordPress 5.4-rc-2
Samsung Galaxy S III on Android 4.4.4 with WordPress 5.3
Samsung Galaxy Tab 3 on Android 4.4.2 with WordPress 5.3

Add fingerprint unlocking

The release of Android 6.0 gives us APIs to interface with fingerprint scanners. It'd be convenient to the user if this was added to the passcode lock screen as an alternative to typing in the four digits.

There are no compatibility libraries to support this, be sure to check the device API level before calling fingerprint APIs.

PIN allows reuse on Android app of Simplenote

Hi team

I noticed that the Simplenote application lock PIN on Android allows reuse.

It is common and highly recommended not to allow this behavior mainly because of the possibility of lost or stolen PINs.

Please check it.

NoClassDefFound error

Hi,

Testing on API level 8 (AVD emulator) and 10 (Genymotion), I get the following error:

    java.lang.NoClassDefFoundError: org.wordpress.passcodelock.AbstractAppLock
            at org.wordpress.passcodelock.PasscodePreferencesActivity.onCreate(PasscodePreferencesActivity.java:39)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
            at android.app.ActivityThread.access$1500(ActivityThread.java:117)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:130)
            at android.app.ActivityThread.main(ActivityThread.java:3683)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:507)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
            at dalvik.system.NativeStart.main(Native Method)

I usually test with API level 18 (Genymotion), where the problem doesn't occur. Could you please check what's happening there?

error

cannot resolve the symbol r in abstractpasscodekeyboardactivity.java

PIN input screen can be easily bypassed

Steps to reproduce the behavior

  1. Switch PIN lock on
  2. Exit the app
  3. Wait a few seconds and then reopen the app - you should see the PIN/fingerprint screen
  4. Press your phone's back button
  5. Quickly reopen the app - you should now be in the app without having to go through the PIN/fingerprint security check

**Tested on Samsung Galaxy S6 Edge, Android 6.0.1

Originally reported on wp-android app here: wordpress-mobile/WordPress-Android#4504

[Samsung-only issue??]

Doesn't work

I add this library to my project, turn passcode on.
i run my app,it shows the password input activity,but i didn't type password,my main activity has showed.It occurs only in first start,when i press home button and back to my app,it can work

which step i missed? i think your guide lacks detail.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.