Added function to check if user filled in correct password.

Added function to check if user filled in correct password,
if this check is not done the script returns in an endless loop.