コード例 #1
0
ファイル: CustomerController.cs プロジェクト: zraja90/MyApps
        public ActionResult Login(LoginModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                if (_customerRegistrationService.ValidateCustomer(model.UserName, model.Password))
                {

                    var customer = _customerService.GetCustomerByUserName(model.UserName);

                    if (customer.TimeZoneId == null)
                    {
                        customer.TimeZoneId = DateTime.UtcNow.ToString();
                        _customerService.Update(customer);
                    }

                    //sign in new customer
                    _authenticationService.Login(customer, model.RememberMe);

                    return RedirectToLocal(returnUrl);
                }
            }

            // If we got this far, something failed, redisplay form
            ModelState.AddModelError("", "The user name or password provided is incorrect.");
            return View(model);
        }
コード例 #2
0
ファイル: CustomerController.cs プロジェクト: zraja90/MyApps
        public ActionResult Login(string returnUrl)
        {
            ViewBag.ReturnUrl = returnUrl;
            var model = new LoginModel();

            return View(model);
        }