Added login validation and error reporting