I don't think you really need the 'password' field right?  Just use the local variable.  It'll have the correct value once the loop is broken.