You should never store a password. If absolutely needed you could store a derivation of that password from a KDF like scrypt, and then see if the user's password
derives to that same value. This is how checking for login passwords is done on Unix and Unix-like systems with shadow passwords (which never store the user's password).
And even with all that I probably screwed something up, but that advice is still better than storing plain passwords.