added function loginUser