Refactoring the login function
Merge branch 'mdm-dev' of github.com:WSO2Mobile/mdm into mdm-dev