Keypad widget to unlock functionality

Keypad widget to unlock functionality

Hello,

Is it possible to use the keypad widget to unlock the ability to use a "Push Button" or any other widget? 

For example, the user inputs their assigned PIN: 1234 and hits "submit". Once the user hits submit something checks whether the code is right and if it is, it will unlock the ability to use another widget. If it is not the right code it will send an error back or say "Wrong PIN"

Let me know if this is possible.