private static void Main(string[] args) { TestRegisterUser(); var ssoClient = new SsoServiceClient(); var ret = ssoClient.Login("test", "1234"); }
private static void TestRegisterUser() { var ssoClient = new SsoServiceClient(); RegisterDto ret = ssoClient.Register("tester", "1234"); if (ret.Status) { Console.WriteLine("Successfully registered."); } else { Console.WriteLine($"Fail to register {ret.Message}"); } }
public ActionResult Login(LoginViewModel loginVM) { if (ModelState.IsValid) { var ssoClient = new SsoServiceClient(); var ret = ssoClient.Login(loginVM.UserName, loginVM.Password); if (ret.Status) // login successfully { var userModel = new UserModel { UserId = ret.UserId, UserName = ret.UserName }; SessionMng.CurrentAccount = userModel; return(RedirectToAction("index", "home")); } else { ModelState.AddModelError("", "Invalid username or password."); } } return(View(loginVM)); }