create model-service pattern for login function