implemented login process and displaying an error if a problem occurs