How to open a door after a numerical password?

I already have my game, it is for iOS, but for the last level I have a door, and I would like that this door could only be open after the user touch the right number sequence, for example 1,2,3,4,5. How can I do it?

First, you have to consider separately the two tasks “Opening the door” and “Checking the password”. The first one is apparently not what matters here.

Once the player understands he’s to type a password (a GUI window telling him so, with a character appearing each time he presses a key maybe ?) you have to listen for each key input. If it’s a letter, concatenates it into the result string. Once the correct number of character is reach, or if the user pressed enter / a button, check if the result matches the password. If it does, open the door.