Added exception handling in login section