コード例 #1
0
ファイル: AccountController.cs プロジェクト: obhita/PROCenter
 public ActionResult SetupAccount(SetupAccountModel model)
 {
     if (ModelState.IsValid)
     {
         if (UserRepository.ValidateUser(model.UserName, model.Password))
         {
             var user = Membership.GetUser(model.UserName);
             if (user.ChangePasswordQuestionAndAnswer(model.Password, model.SecurityQuestion, model.SecurityAnswer))
             {
                 user.ChangePassword(model.Password, model.NewPassword);
                 UserRepository.ValidateUser(model.UserName, model.NewPassword);
                 return(SignIn(model.UserName,
                               AuthenticationMethods.X509,
                               model.ReturnUrl,
                               false,
                               ConfigurationRepository.Global.SsoCookieLifetime));
             }
             else
             {
                 ModelState.AddModelError("", Resources.AccountController.BadSecurityAnswer);
             }
         }
         else
         {
             ModelState.AddModelError("", Resources.AccountController.IncorrectCredentialsNoAuthorization);
         }
     }
     SetupSecurityQuestions();
     return(View(model));
 }
コード例 #2
0
ファイル: AccountController.cs プロジェクト: obhita/PROCenter
        // shows the signin screen
        public ActionResult SetupAccount(SignInModel model)
        {
            // you can call AuthenticationHelper.GetRelyingPartyDetailsFromReturnUrl to get more information about the requested relying party

            var vm = new SetupAccountModel(model);

            vm.Password = null;

            SetupSecurityQuestions();

            return(View(vm));
        }