public JsonResult UpdateSecurityQuestion(SecurityQuestionModel model, string password)
        {
            string sErrorMsg = null;
            bool   bSuccess  = false;

            try {
                StringActionResult sar = this.serviceClient.Instance.UserUpdateSecurityQuestion(
                    this.context.User.Name,
                    UiCustomerOrigin.Get().GetOrigin(),
                    new DasKennwort(password),
                    model.Question,
                    model.Answer
                    );

                sErrorMsg = sar.Value;

                bSuccess = string.IsNullOrWhiteSpace(sErrorMsg);
            } catch (Exception e) {
                ms_oLog.Alert(e, "Failed to update security question for customer '{0}'.", this.context.User.Name);
                sErrorMsg = "Failed to update security question.";
                bSuccess  = false;
            }             // try

            return(Json(new { success = bSuccess, error = sErrorMsg, }));
        }         // UpdateSecurityQuestion
Exemplo n.º 2
0
 public static UserSecurityAnswerViewModel ToUserSecurityAnswerViewModel(this SecurityQuestionModel securityQuestionModel)
 {
     return(new UserSecurityAnswerViewModel
     {
         SecurityQuestion = securityQuestionModel.ToSecurityQuestionViewModel()
     });
 }
Exemplo n.º 3
0
 public static SecurityQuestionViewModel ToSecurityQuestionViewModel(this SecurityQuestionModel securityQuestionModel)
 {
     return(new SecurityQuestionViewModel
     {
         Id = securityQuestionModel.Id,
         Question = securityQuestionModel.Question
     });
 }
Exemplo n.º 4
0
 public static SecurityQuestion ToSecurityQuestion(this SecurityQuestionModel securityQuestionModel)
 {
     return(new SecurityQuestion
     {
         Id = securityQuestionModel.Id,
         Question = securityQuestionModel.Question,
     });
 }
Exemplo n.º 5
0
        public SecurityQuestionModel GetSecurityQuestionForNewUser()
        {
            DataSet ds = DataAccess.ExecuteDataset("MTS_GETACTIVESECURITYQUESTIONS");

            SecurityQuestionModel securityQModel = new SecurityQuestionModel();

            securityQModel.SecurityQsns = GetSelectListItem(ds.Tables[0]);

            return(securityQModel);
        }
Exemplo n.º 6
0
        public SecurityQuestionModel GetSecurityQuestion()
        {
            DataSet ds = DataAccess.ExecuteDataset("MTS_GetSecurityQuestions");

            SecurityQuestionModel securityQModel = new SecurityQuestionModel();

            securityQModel.SecurityQsns = GetSelectListItem(ds.Tables[0]);

            return(securityQModel);
        }
Exemplo n.º 7
0
        public SecurityQuestionModel initialDDLFill()
        {
            try
            {
                UserLogonData userLogon = new UserLogonData();

                SecurityQuestionModel securityQuestionModel = userLogon.GetSecurityQuestion();
                return(securityQuestionModel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// To the view model.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        public static SecurityQuestionViewModel ToViewModel(this SecurityQuestionModel model)
        {
            if (model == null)
            {
                return(null);
            }

            var entity = new SecurityQuestionViewModel
            {
                SecurityQuestionID = model.SecurityQuestionID,
                Question           = model.Question
            };

            return(entity);
        }
        /// <summary>
        /// To the model.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public static SecurityQuestionModel ToModel(this SecurityQuestionViewModel entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var model = new SecurityQuestionModel
            {
                SecurityQuestionID = entity.SecurityQuestionID,
                Question           = entity.Question
            };

            return(model);
        }
Exemplo n.º 10
0
        public ActionResult SecurityQuestions()
        {
            try
            {
                UserLogonData userLogon = new UserLogonData();

                SecurityQuestionModel securityQuestionModel = userLogon.GetSecurityQuestionForNewUser();

                return(View(securityQuestionModel));
            }

            catch (Exception ex)
            {
                throw ex;
            }
        }
        public override async Task <ISecurityQuestionModel> SelectByIDAsync(long id, long userId, CancellationToken cancellationToken)
        {
            DataTable dt;

            Dictionary <string, object> param = new Dictionary <string, object>();

            param.Add(DBObjects.SPParameter.SecurityQuestionId, GetParameter(DBObjects.SPParameter.SecurityQuestionId, ParameterDirection.Input, ((int)SqlDbType.NVarChar), 8, id));
            param.Add(DBObjects.SPParameter.UserId, GetParameter(DBObjects.SPParameter.UserId, ParameterDirection.Input, ((int)SqlDbType.BigInt), 8, userId));
            dt = await this.GetSPDataTableAsync(DBObjects.StoredProcedures.pspSecurityQuestionSelectById.ToString(), cancellationToken, param);

            ISecurityQuestionModel model = new SecurityQuestionModel();

            model.SecurityQuestionId = Convert.ToInt64(dt.Rows[0][DBObjects.Fields.SecurityQuestionId]);
            model.Question           = dt.Rows[0][DBObjects.Fields.Question].ToString();
            model.IsActive           = Convert.ToBoolean(dt.Rows[0][DBObjects.Fields.IsActive]);
            return(model);
        }
Exemplo n.º 12
0
        public async Task <ActionResult> Index(SecurityQuestionModel model, CancellationToken cancellationToken)
        {
            if (!ModelState.IsValid)
            {
                ViewData[Constant.CustomSuccessMessage] = Constant.CustomValidationErrorMessage;
                ViewData[Constant.QuerySuccess]         = false;
                model = (SecurityQuestionModel)await _service.IndexAsync(this.HttpContext.ApplicationInstance.Context, GetCanellationToken(cancellationToken));

                return(View(model));
            }
            ModelState.Clear();
            model = (SecurityQuestionModel)await _service.SaveAsync(this.HttpContext.ApplicationInstance.Context, model, GetCanellationToken(cancellationToken));

            ViewData[Constant.QuerySuccess] = HttpContext.Items[Constant.QuerySuccess];
            ViewData[Constant.FormTitle]    = HttpContext.Items[Constant.FormTitle];

            if (System.Convert.ToBoolean(ViewData[Constant.QuerySuccess]))

            {
                ViewData[Constant.FormTitle] = "EDIT Security Question";
            }
            return(View(model));
        }
Exemplo n.º 13
0
        public ActionResult SecurityQuestions(SecurityQuestionModel model, string SecAns)
        {
            try
            {
                LogonUserSession logonUserSession = (LogonUserSession)SessionHelper.LogonUser;
                if (ModelState.IsValid)
                {
                    encryptSha1           encrypt  = new encryptSha1();
                    SecurityQuestionModel secmodel = new SecurityQuestionModel();
                    Int64 userId = Int64.Parse(logonUserSession.USERID.ToString());

                    encryptSha1 obj     = new encryptSha1();
                    string      secAnsr = obj.GetSHA1HashData(model.SecAns.ToUpper());

                    string curPwd = logonUserSession.CURRENTPASSWORD.ToString();           // model.InhrChangePasswordModel.HashCurrentPassword;
                    string newPwd = encrypt.GetSHA1HashData(model.NewPassword + userId);   //model.InhrChangePasswordModel.HashConfirmPassword;


                    int pwdCount = Int32.Parse(logonUserSession.PASSWORDCOUNT.ToString());

                    if (string.Equals(logonUserSession.TEMPUSERNAME.ToString(), model.NewPassword, StringComparison.OrdinalIgnoreCase))
                    {
                        ModelState.AddModelError("NewPassword", "Username and New Password should not be same.");
                        model = initialDDLFill();
                    }
                    else if (string.Equals(curPwd, newPwd, StringComparison.OrdinalIgnoreCase))
                    {
                        ModelState.AddModelError("NewPassword", "NewPassword should not be equal to CurrentPassword");
                        model = initialDDLFill();
                    }

                    else
                    {
                        int userResult = InsertSecurityQsn(userId, curPwd, newPwd, model.SelectedSecQsn, secAnsr, pwdCount);
                        // 3 ALREADY ;  < 0 pass
                        if (userResult == 3)
                        {
                            model         = initialDDLFill();
                            model.Message = "New password already used"; //Msg.EXISTPWD;
                        }
                        else if (userResult == 1)
                        {
                            logonUserSession.STATUS          = Status.CHGPWD;
                            logonUserSession.CURRENTPASSWORD = newPwd;
                            logonUserSession.USERNAME        = logonUserSession.TEMPUSERNAME.ToString();
                            logonUserSession.TEMPUSERNAME    = null;
                            SessionHelper.LogonUser          = logonUserSession;
                            return(RedirectToAction("LogOn"));
                        }
                        else
                        {
                        }
                    }
                }
                else
                {
                    model = initialDDLFill();
                }
                return(View(model));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 14
0
        public async override Task <ISecurityQuestionModel> IndexAsync(System.Web.HttpContext context, CancellationToken cancellationToken)
        {
            ISecurityQuestionModel model = new SecurityQuestionModel();

            return(model);
        }