EddyVerbruggen / cordova-plugin-touch-id

:nail_care: 👱‍♂️ Forget passwords, use a fingerprint scanner!
MIT License
214 stars 72 forks source link

When no fingerprints are enrolled - doesn't fall back to pin/password #79

Open ccoplestone opened 5 years ago

ccoplestone commented 5 years ago

Hi,

I can't seem to get the plugin to fall back to a PIN or Password if no fingerprints are enrolled.

// ios fingerprint logic
window.plugins.touchid.isAvailable(
    function () {
        window.plugins.touchid.verifyFingerprint(
            'Scan your fingerprint please', // this will be shown in the native scanner popup
            'Enter PIN/Password',
            function () {
                localStorage.setItem('access', '1');
                window.location.replace(window.location.href);
            }, // success handler: fingerprint accepted
            function () {
                if (err === "Cancelled") {
                    localStorage.removeItem('token');
                } else {
                    console.log("FingerprintAuth Error: " + err);
                }
            } // error handler with errorcode and localised reason
        );
    }, // success handler: TouchID available
    function (msg) {} // error handler: no TouchID available
)

Am I doing something wrong here, or is this an issue?

Any help will be greatly appreciated.

Cheers!

danicholls commented 5 years ago

Does this help you? https://github.com/EddyVerbruggen/cordova-plugin-touch-id/issues/78

ccoplestone commented 5 years ago

Does this help you? #78

Not quite, not what I'm after unfortunately. For now, if there are no fingerprints enrolled I've removed the token in localstorage and re-directed to the login page. Not ideal, but it'll work for now.