コード例 #1
0
ファイル: AccountController.cs プロジェクト: ramkumar013/ECMS
        public ActionResult Login(LoginModel model, string returnUrl)
        {
            if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
            {
                DefaultUserProfileService service = new DefaultUserProfileService(SecurityHelper.Decrypt(ConfigurationManager.ConnectionStrings["mongodb"].ConnectionString, true));
                ECMSMember member = service.GetProfileByUserName(model.UserName);
                DependencyManager.CachingService.Set <ECMSMember>("LoggedInUser", member);
                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
ファイル: AccountController.cs プロジェクト: ramkumar013/ECMS
        public ActionResult Login(LoginModel model, string returnUrl)
        {
            if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
            {
                DefaultUserProfileService service = new DefaultUserProfileService(SecurityHelper.Decrypt(ConfigurationManager.ConnectionStrings["mongodb"].ConnectionString, true));
                ECMSMember member = service.GetProfileByUserName(model.UserName);
                DependencyManager.CachingService.Set<ECMSMember>("LoggedInUser", member);
                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);
        }