コード例 #1
0
        public bool IsCheckExist(ForgotPassReset forgotPassResetModel)
        {
            try
            {
                int result = 0;
                using (var connection = this.GetConnection())
                {
                    string query;

                    query = @"Select count(*) from " + dbUser + "application_user  where username = '******' " +
                            "and Employee_Id = '" + forgotPassResetModel.EmployeeId.Trim() + "' " +
                            "and mobile_no = '" + forgotPassResetModel.MobileNo.Trim() + "' " +
                            "and email_id= '" + forgotPassResetModel.OfficialEmail.Trim() + "'";


                    //var result = connection.QueryFirstOrDefault<dynamic>(query);
                    result = connection.Query <int>(query).FirstOrDefault();
                    this.CloseConnection(connection);
                    if (result > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        public object ResetPasswordForForgot([FromBody] ForgotPassReset model)
        {
            try
            {
                //var modelToChange = usersService.SingleOrDefault(model.Id, new ApplicationUser());
                var modelToChange = usersService.SingleOrDefaultByCustomField(model.UserName, "username", new ApplicationUser());
                modelToChange         = generateSecuredCredentials(modelToChange);
                modelToChange.Pstatus = "N";
                modelToChange         = usersService.Update(modelToChange);

                Email objEmail = new Email();
                objEmail.EMAIL    = model.OfficialEmail;
                objEmail.TEMPLETE = "2";
                //objEmail.DATA1 = "Password Reset";
                objEmail.DATA1 = modelToChange.PlainPassword;
                //objEmail.DATA2 = "Your password for OKWallet Application User has been reset and password is " + modelToChange.PlainPassword;
                emailService.SendVeriCodeToEmail(objEmail);

                ApplicationUser prevModel = new ApplicationUser();
                prevModel         = modelToChange;
                prevModel.Pstatus = "L";

                //Insert into audit trial audit and detail
                _auditTrailService.InsertUpdatedModelToAuditTrail(modelToChange, prevModel, model.UserName, 7, 4, "Application User", modelToChange.Username, "Password Reset Successfully!");

                return(modelToChange);
            }
            catch (Exception ex)
            {
                return(errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString()));
            }
        }
コード例 #3
0
        public object SendVeriCodeToEmailAfterChecking([FromBody] ForgotPassReset forgotPassResetModel)
        {
            try
            {
                if (emailService.IsCheckExist(forgotPassResetModel))
                {
                    Email objEmail = new Email();
                    objEmail.EMAIL    = forgotPassResetModel.OfficialEmail;
                    objEmail.TEMPLETE = "1";
                    //objEmail.DATA1 = "Email Verification Code for OK Wallet Application User";


                    StringBuilderService stringBuilderService = new StringBuilderService();
                    int    randromNumber = stringBuilderService.RandomNumber(1000, 9999);
                    string md5Password   = stringBuilderService.GenerateMD5Hash(randromNumber.ToString());
                    objEmail.DATA1 = randromNumber.ToString();
                    //objEmail.DATA2 = "Your email verification code for OK Wallet Application User is : " + randromNumber.ToString();
                    emailService.SendVeriCodeToEmail(objEmail);
                    return(md5Password);
                }
                else
                {
                    return("");
                }
            }
            catch (Exception ex)
            {
                return(errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString()));
            }
        }
コード例 #4
0
 public bool IsCheckExist(ForgotPassReset forgotPassResetModel)
 {
     return(repo.IsCheckExist(forgotPassResetModel));
 }