Added client side and server side validation for the user login

Fix #786