I think you got a mistake in this part of the code:

( NVL(p_passwd1,NULL) <> NVL(p_passwd2,NULL)

1) if p_passwd1 and p_passwd2 are both NULL you do not change their value in order to compare then so you compare two NULL´s.

That´s a common mistake.
Always remember NULL is different from any other NULL.

2) If only one p_passwd1 or p_passwd2 are not null you can not compare a character with null, you should use <<character>> is not null or <<character>> is null.

So try changing that NULL values and see what happens.