コード例 #1
0
        public ActionResult Signin(SigninViewModel model)
        {
            var validator = new AccountValidator();

            validator.LogEventHandler += HandleLogEvents;

            if (!validator.IsValidCredentials(model.Username, model.Password))
            {
                LogError($"Login validation failed for {nameof(model.Username)}: {model.Username} using {nameof(model.Password)}: {model.Password}.");
                return(View(new SigninViewModel {
                    IsFailedAuthentication = true
                }));
            }

            LogMessage($"Login validation succeded for {nameof(model.Username)}: {model.Username} using {nameof(model.Password)}: {model.Password}.");
            CurrentLoginData = model;
            TsUserName       = model.Username;

            LogMessage($"Redirecting to {Url.Action("SelectSite", "Account")}.");
            return(RedirectToAction("SelectSite", "Account"));
        }