code for login validation before logging -in