Modified login function

- Changed parameters to pass
- Added LoginError exception