Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOWTO] use this for one-time validation against a server #155

Closed
Relax594 opened this issue Sep 20, 2020 · 4 comments · Fixed by #170
Closed

[HOWTO] use this for one-time validation against a server #155

Relax594 opened this issue Sep 20, 2020 · 4 comments · Fixed by #170

Comments

@Relax594
Copy link

I want to authenticate a user with a one-time pin input and send that pin to a server to validate him. If i set status to "choose" the user has to input the pin two times before handleResultEnterPin gets called. Setting the status to "enter" results in TypeError: null is not an object (evaluating 'RNKeychainManager.getInternetCredentialsForServer'). The PIN should not get stored somewhere and always has to be validated by a server on every app start. Reason is that there is a windows tool, which has the functionality to reset or change the PIN for the user.

const RequestPinScreen = memo(({ navigation, route }) => {
    const dispatch = useDispatch();
    const { id } = route.params;

    const handleResultEnterPin = (pin) => {
        dispatch(mitarbeiterActions.authenticate({ mitarbeiterid: id, pin: pin }));
    };

    return (
        <SafeAreaView style={styles.root} edges={['left', 'right']}>
            <PINCode
                status="choose"
                storePin={(pin) => handleResultEnterPin(pin)}
                handleResultEnterPin={(pin) => handleResultEnterPin(pin)}
            />
        </SafeAreaView>
    );
});

Thank you very much!

@jeremy-farnault
Copy link
Contributor

Hi,

Indeed it'd need to fixed. However it's quite a busy time for us at the moment so if you need this fixed before the next couple of weeks, I'd suggest you open a PR. That'd very appreciated.
If you can't do it, I'll try to have a go at it asap.

Cheers

@Relax594
Copy link
Author

I tried to fix it in my own copy but wasn't able to. I removed all code that has something to do with Keychain so at least the Typeerror is gone.

I would be happy to help but I think I'm not able to..

@dawiddyd
Copy link

dawiddyd commented Oct 31, 2020

@Relax594 I don't know if I'm right, but you can get the same result using endProcessFunction.

const RequestPinScreen = memo(({ navigation, route }) => {
    const dispatch = useDispatch();
    const { id } = route.params;

    const handleResultEnterPin = (pinCode) => {
        dispatch(mitarbeiterActions.authenticate({ mitarbeiterid: id, pin: pinCode }));
    };

    return (
        <SafeAreaView style={styles.root} edges={['left', 'right']}>
            <PINCode
                status="enter"
                endProcessFunction={(pinCode) => handleResultEnterPin(pinCode)}
            />
        </SafeAreaView>
    );
});

@Relax594
Copy link
Author

Yes but no. The way this repo works does not allow this. It's a bug as stated by @Haskkor

leo-maidea added a commit to leo-maidea/react-native-pincode that referenced this issue Jan 14, 2021
Simple support for external PIN validation . resolves jarden-digital#153 and jarden-digital#155
handleResultEnterPin can optionally return bolean to override internal pin validity check
leo-maidea added a commit to leo-maidea/react-native-pincode that referenced this issue Jan 14, 2021
Simple support for external PIN validation . resolves jarden-digital#153 and jarden-digital#155
handleResultEnterPin can optionally return bolean to override internal pin validity check
leo-maidea added a commit to leo-maidea/react-native-pincode that referenced this issue Jan 14, 2021
Simple support for external PIN validation . resolves jarden-digital#153 and jarden-digital#155
handleResultEnterPin can optionally return bolean to override internal pin validity check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants