login function implemented (clients can check username and password)
refactoring