Password protected system

how safe is it going to be if anyone can press the button and set up a new password?

your code needs to have some sort of master password (using the keypad) that is used to enter admin mode where you can change the password. Of course this password needs then to be saved in EEPROM for the next time you boot so you should read about the EEPROM library too.

as you'll manage different states for your code (locked, unlocked, admin mode, ...) you might benefit from studying state machines. Here is a small introduction to the topic: Yet another Finite State Machine introduction