Exemplo n.º 1
0
        public HttpResponseMessage Change(ChangePassword model) {
            if(!ModelState.IsValid) {
                return Request.CreateErrorResponse(
                    HttpStatusCode.BadRequest,
                    ModelState);
            }

            try {
                if(changePassword(
                    User.Identity.Name,
                    model.OldPassword,
                    model.NewPassword)) {
                    return Request.CreateResponse(HttpStatusCode.NoContent);
                }

                ModelState.AddModelError(
                    "oldPassword",
                    "Old password does not match existing password.");
            } catch(ArgumentException) {
                ModelState.AddModelError(
                    "newPassword",
                    "New password does not meet password rule.");
            }

            return Request.CreateErrorResponse(
                HttpStatusCode.BadRequest,
                ModelState);
        }
Exemplo n.º 2
0
        public HttpResponseMessage Change(ChangePassword model)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(
                    HttpStatusCode.BadRequest,
                    ModelState);
            }

            var success = changePassword(
                User.Identity.Name,
                model.OldPassword,
                model.NewPassword);

            return Request.CreateResponse(
                success ?
                HttpStatusCode.NoContent :
                HttpStatusCode.BadRequest);
        }
        public async Task<HttpResponseMessage> Change(ChangePassword model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(
                    HttpStatusCode.BadRequest,
                    ModelState);
            }

            try
            {
                if (await membershipService.ChangePassword(
                    User.Identity.Name,
                    model.OldPassword,
                    model.NewPassword))
                {
                    return Request.CreateResponse(HttpStatusCode.NoContent);
                }

                ModelState.AddModelError(
                    "oldPassword",
                    "Old password does not match existing password.");
            }
            catch (ArgumentException)
            {
                ModelState.AddModelError(
                    "newPassword",
                    "New password does not meet password rule.");
            }

            return Request.CreateErrorResponse(
                HttpStatusCode.BadRequest,
                ModelState);
        }
Exemplo n.º 4
0
        public ActionResult ChangePassword(ChangePassword cp)
        {
            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(cp.CurrentPassword) && !string.IsNullOrEmpty(cp.NewPassword) && !string.IsNullOrEmpty(cp.ReEnterPassword))
                {
                    User user = db.Users.Find(new Guid(Request.Cookies["INDMS"]["UserID"]));

                    if (user != null)
                    {
                        if (System.Text.Encoding.ASCII.EncodeBase64(cp.CurrentPassword).Equals(user.Password))
                        {
                            user.Password = System.Text.Encoding.ASCII.EncodeBase64(cp.NewPassword);
                            try
                            {
                                db.SaveChanges();
                                TempData["MSG"] = "Password changed successfully.";
                                return RedirectToAction("ChangePassword");
                            }
                            catch (RetryLimitExceededException /* dex */)
                            {
                                //Log the error (uncomment dex variable name and add a line here to write a log.
                                TempData["Error"] = "Unable to save changes. Try again, and if the problem persists, see your system administrator.";
                            }
                        }
                        else
                        {
                            TempData["Error"] = "Current Password not matched.";
                        }
                    }
                }
                else
                {
                    TempData["Error"] = "All Field are required.";
                }
            }
            return View();
        }
 public Boolean ChangePassword(ChangePassword changePassword)
 {
     return(_service.ChangePassword(changePassword));
 }
Exemplo n.º 6
0
        public async Task <AuthenticationResult> CustomerChangePasswsord(ChangePassword pass)
        {
            try
            {
                var user = await _userManager.FindByEmailAsync(pass.Email);

                var userPassword = await _userManager.CheckPasswordAsync(user, pass.OldPassword);

                if (!userPassword)
                {
                    return(new AuthenticationResult
                    {
                        Status = new APIResponseStatus
                        {
                            IsSuccessful = false,
                            Message = new APIResponseMessage
                            {
                                FriendlyMessage = "This password is not associated to this account",
                            }
                        }
                    });
                }

                string token = await _userManager.GeneratePasswordResetTokenAsync(user);

                var changepassword = await _userManager.ResetPasswordAsync(user, token, pass.NewPassword);

                if (!changepassword.Succeeded)
                {
                    return(new AuthenticationResult
                    {
                        Status = new APIResponseStatus
                        {
                            IsSuccessful = false,
                            Message = new APIResponseMessage
                            {
                                FriendlyMessage = changepassword.Errors.Select(x => x.Description).FirstOrDefault(),
                            }
                        }
                    });
                }

                return(await CustomerGenerateAuthenticationResultForUserAsync(user));
            }
            catch (Exception ex)
            {
                #region Log error
                var errorCode = ErrorID.Generate(4);
                _logger.Error($"ErrorID :  {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
                return(new AuthenticationResult
                {
                    Status = new APIResponseStatus
                    {
                        Message = new APIResponseMessage
                        {
                            FriendlyMessage = "Error occured!! Please try again later",
                            MessageId = errorCode,
                            TechnicalMessage = $"ErrorID :  {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}"
                        }
                    }
                });

                #endregion
            }
        }
Exemplo n.º 7
0
        public HttpResponseMessage ChangePassword(ChangePassword ChangePassword)
        {
            int ret = repository.ChangePassword(pclsCache, ChangePassword.OldPassword, ChangePassword.NewPassword, ChangePassword.UserId, ChangePassword.revUserId, ChangePassword.TerminalName, new CommonFunction().getRemoteIPAddress(), ChangePassword.DeviceType);

            return(new ExceptionHandler().ChangePassword(Request, ret));
        }
        public async Task <HttpResponseMessage> PasswordChange(ChangePassword req)
        {
            try
            {
                SettingDAL dal = new SettingDAL();
                //JsonResponse response = await PasswordChanges(req);
                JsonResponse response = new JsonResponse();
                using (MIUEntities db = new MIUEntities())
                {
                    try
                    {
                        User user = db.Users.Where(x => x.ID == req.UserID).FirstOrDefault();
                        if (user == null)
                        {
                            response.Flag    = true;
                            response.Message = "User not found.";
                        }
                        else
                        {
                            string Message = "";
                            if (user.Password == req.CurrentPassword)
                            {
                                if (req.NewPassword == req.ComfirmPassword)
                                {
                                    user.Password = req.NewPassword;
                                    var            AspNetUserID = db.AspNetUsers.Where(x => x.UserName == user.LoginName).Select(x => x.Id).FirstOrDefault();
                                    IdentityResult result       = await UserManager.ChangePasswordAsync(AspNetUserID, req.CurrentPassword, req.NewPassword);

                                    if (!result.Succeeded)
                                    {
                                        Message = "Fail to change password!";
                                    }
                                    else
                                    {
                                        db.SaveChanges();
                                        Message = "Update Password Successfully!.";
                                    }
                                }
                                else
                                {
                                    Message = "New password and confirm password are not same.";
                                }
                            }
                            else
                            {
                                Message = "Current Password is incorrect.";
                            }
                            //db.SaveChanges();
                            response.Flag    = true;
                            response.Message = Message;
                        }
                    }
                    catch (Exception ex)
                    {
                        //return new JsonResponse() { Flag = true, Message = Message };
                        response.Flag    = true;
                        response.Message = ex.Message;
                    }
                }
                if (response != null && response.Flag)
                //if (response)
                {
                    return(Request.CreateResponse <JsonResponse>(HttpStatusCode.OK, response));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, MIUWebAPI.Helper.Constants.ErrorNotFound));
                }
            }
            catch (DbEntityValidationException ex)
            {
                var    controllerName = ControllerContext.RouteData.Values["controller"].ToString();
                var    actionName     = ControllerContext.RouteData.Values["action"].ToString();
                Logger log            = new Logger();
                log.ErrorLog(ex, controllerName, actionName);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, MIUWebAPI.Helper.Constants.ErrorSysError));
            }
        }
 public ChangePassword LoadSecretQuestions(ChangePassword objChangePassword)
 {
     objChangePassword.secretQuestions = objUserManagementLogic.FetchSecretQuestion();
     return(objChangePassword);
 }
 public ChangePassword Sendmailsmsresetpassword(ChangePassword Password)
 {
     Password.IsStatus = objUserManagementLogic.Sendmailsmsresetpassword(Password.mobileno, Password.emailID);
     return(Password);
 }
Exemplo n.º 11
0
        public async Task<ActionResult> ChangePassword(ChangePassword formModel)
        {
            var changePassword = new VirtoCommercePlatformWebModelSecurityChangePasswordInfo
            {
                OldPassword = formModel.OldPassword,
                NewPassword = formModel.NewPassword,
            };

            var result = await _platformApi.SecurityChangePasswordAsync(WorkContext.CurrentCustomer.UserName, changePassword);

            if (result.Succeeded == true)
            {
                return StoreFrontRedirect("~/account");
            }
            else
            {
                ModelState.AddModelError("form", result.Errors.First());
                return View("customers/account", WorkContext);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Returns a view to change existing password
        /// </summary>
        /// <returns></returns>
        public ActionResult ChangePassword()
        {
            var changePassword = new ChangePassword();

            return(View(changePassword));
        }
Exemplo n.º 13
0
 protected void OnActionPasswordActivated(object sender, EventArgs e)
 {
     ChangePassword WinPass = new ChangePassword();
     WinPass.WorkMode = ChangePassword.Mode.Manual;
     WinPass.CanSetEmptyPassword = true;
     WinPass.Show();
     if(WinPass.Run() == (int) Gtk.ResponseType.Ok)
     {
         MainClass.Parameters.UpdateParameter(QSMain.ConnectionDB, "admin_password", WinPass.NewPassword);
     }
     WinPass.Destroy();
 }
Exemplo n.º 14
0
        private void SystemMenuClick(object sender, ItemClickEventArgs e)
        {
            switch (e.Item.Name)
            {
            case "iRestart":
                Application.Restart();
                break;

            case "iExit":
                if (XtraMessageBox.Show("Vui lòng xác nhận thoát khỏi ứng dụng?", "Xác nhận", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    Application.Exit();
                }
                break;

            case "iUserConfig":
                UserConfigAcc frmUserConfig = new UserConfigAcc();
                if (frmUserConfig.IsShow)
                {
                    frmUserConfig.ShowDialog();
                }
                break;

            case "iCheckData":
                CheckData frmCheckData = new CheckData(true);
                frmCheckData.ShowDialog();
                break;

            case "iViewHistory":
                CheckData frmViewHistory = new CheckData(false);
                frmViewHistory.ShowDialog();
                break;

            case "iChangePassword":
                ChangePassword frmChangePwd = new ChangePassword();
                frmChangePwd.ShowDialog();
                break;

            case "iAbout":
                About frmAbout = new About();
                frmAbout.ShowDialog();
                break;

            case "iHelpOnline":
                System.Diagnostics.Process.Start("http://www.sgd.com.vn");
                break;

            case "iHelp":
                string fileHelp = Config.GetValue("Package").ToString() + ".chm";
                if (System.IO.File.Exists(fileHelp))
                {
                    System.Diagnostics.Process.Start(fileHelp);
                }
                break;

            case "iBackup":
                DataMaintain dmBk = new DataMaintain();
                if (dmBk.BackupData(Application.StartupPath))
                {
                    MessageBox.Show("Bakup Hoàn thành");
                }
                else
                {
                }
                break;

            case "iDelete":
                Xoasolieu fxoasolieu = new Xoasolieu();
                fxoasolieu.ShowDialog();
                break;

            case "iRestore":
                string isAdmin = Config.GetValue("Admin").ToString();
                if (isAdmin != "True")
                {
                    return;
                }
                DataMaintain  dmRt = new DataMaintain();
                DateTime      d;
                FrmDateSelect f = new FrmDateSelect();
                f.ShowDialog();
                d = f.d;
                if (d != null)
                {
                    if (File.Exists(Application.StartupPath + "\\Backup\\" + dbName + d.ToString("dd_MM_yyyy") + ".dat"))
                    {
                        if (MessageBox.Show("Bạn có chắc chắn phục hồi số liệu ngày " + d.ToString("dd/MM/yyyy") + " không?, Dữ liệu hiện tại sẽ bị mất sau khi phục hồi!", "Xác nhận", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            if (dmRt.RestoreData(Application.StartupPath + "\\Backup\\" + dbName + d.ToString("dd_MM_yyyy") + ".dat"))
                            {
                                MessageBox.Show("Phục hồi số liệu hoàn thành!");
                            }
                            else
                            {
                                MessageBox.Show("Phục hồi số liệu bị lỗi!");
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Không tồn tại file backup ngày " + d.ToString("dd/MM/yyyy"));
                    }
                }
                break;

            case "iRestoreAs":
                string isAdmin1 = Config.GetValue("Admin").ToString();
                if (isAdmin1 != "True")
                {
                    return;
                }
                DataMaintain dmRtas = new DataMaintain();
                DateTime     d1;
                string       dataAnother;
                FrmRestoreAs fres = new FrmRestoreAs();
                fres.ShowDialog();
                d1          = fres.d;
                dataAnother = fres.DataAnother;
                if (d1 != null && dataAnother != null)
                {
                    if (File.Exists(Application.StartupPath + "\\Backup\\" + dbName + d1.ToString("dd_MM_yyyy") + ".dat") && !File.Exists(Application.StartupPath + "\\Data2005\\" + dataAnother + ".mdf"))
                    {
                        if (MessageBox.Show("Bạn có chắc chắn phục hồi số liệu ngày " + d1.ToString("dd/MM/yyyy") + " vào dữ liệu " + dataAnother + " không?", "Xác nhận", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            if (dmRtas.RestoreDataToAnother(Application.StartupPath + "\\Data2005\\", Application.StartupPath + "\\Backup\\" + dbName + d1.ToString("dd_MM_yyyy") + ".dat", dataAnother))
                            {
                                MessageBox.Show("Tạo số liệu hoàn thành!");
                            }
                            else
                            {
                                MessageBox.Show("Tạo số liệu bị lỗi!");
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Không tồn tại file backup ngày " + d1.ToString("dd/MM/yyyy") + " hoặc đã tồn tại database " + dataAnother);
                    }
                }
                break;

            case "iCollectData":
                FrmDataCollection frmDc = new FrmDataCollection();
                frmDc.ShowDialog();
                break;

            case "iImportExcel":
                CDTSystem.fImExcel frmImportEx = new CDTSystem.fImExcel();
                frmImportEx.MdiParent = this;
                frmImportEx.Show();
                break;

            case "iChonNLV":
                fChonNgayLV fChonNLV = new fChonNgayLV();
                fChonNLV.ShowDialog();
                break;

            case "isImportData":
                DateFilter dfilterIm = new DateFilter();
                //dfilter.MdiParent = this;
                dfilterIm.ShowDialog();
                if (dfilterIm.isAccept)
                {
                    ImportDataFromDat I2Dat = new ImportDataFromDat(dfilterIm.TuNgay, dfilterIm.DenNgay);
                    if (!I2Dat.Import())
                    {
                        MessageBox.Show("Kết nhập dữ liệu không thành công");
                    }
                    else
                    {
                        MessageBox.Show("Kết nhập dữ liệu thành công");
                    }
                }
                break;

            case "isExportData":
                DateFilter dfilterEx = new DateFilter();
                //dfilter.MdiParent = this;
                dfilterEx.ShowDialog();
                if (dfilterEx.isAccept)
                {
                    ExportData2Dat E2Dat = new ExportData2Dat(dfilterEx.TuNgay, dfilterEx.DenNgay);
                    if (!E2Dat.Export())
                    {
                        MessageBox.Show("Xuất dữ liệu không thành công");
                    }
                    else
                    {
                        MessageBox.Show("Xuất dữ liệu thành công");
                    }
                }
                break;
            }
        }
        private void ChangeExecute()
        {
            ChangePassword change = new ChangePassword(Username);

            change.ShowDialog();
        }
        private void btnChangePassword_Click(object sender, EventArgs e)
        {
            ChangePassword password = new ChangePassword(UserId);

            password.ShowDialog();
        }
Exemplo n.º 17
0
        public async Task <Model.Response.ApplicationUser> UpdatePassword(int applicationUserId, ChangePassword password)
        {
            Database.ApplicationUser user = await auth.Users.FindAsync(applicationUserId);

            if (PasswordHasher.VerifyHashedPassword(user, user.PasswordHash, password.CurrentPassword) != PasswordVerificationResult.Success)
            {
                throw new ModelStateException(nameof(password.CurrentPassword), "Current password is not correct");
            }
            user.PasswordHash = PasswordHasher.HashPassword(user, password.NewPassword);
            try
            {
                await auth.SaveChangesAsync();

                // TODO: Dodati log
            }
            catch (Exception e)
            {
                // TODO: Dodati log
                throw e;
            }
            return(mapper.Map <Model.Response.ApplicationUser>(user));
        }
Exemplo n.º 18
0
 public override bool SecurityApiCallRegisterOrChangeNewPassword(string url, string pathController, ChangePassword content = null, RegisterUser user = null)
 {
     if (url.Equals("http://academysecuritydos.azurewebsites.net/"))
     {
         if (pathController.Equals("api/NewPassword/ChangePassword"))
         {
             if (content.UserName != null && content.UserName != "" && content.NewPassword != null && content.NewPassword != "")
             {
                 return(true);
             }
         }
         else if (pathController.Equals("api/NewUser/CreateUser"))
         {
             if (user.UserName == null || user.UserName == "" && user.FirstName == null || user.FirstName == "" && user.LastName == null || user.LastName == "" && user.Password == null || user.Password == "")
             {
                 return(false);
             }
             else
             {
                 return(true);
             }
         }
     }
     return(false);
 }
        /// <summary>
        /// Created By: Satish
        /// Created Date: 18 July 2013
        /// Function for change password which will get credentials from change password page and send user current status.
        /// </summary>
        public string ChangePassword(Stream Parameterdetails)
        {
            ChangePassword objChangePassword = new ChangePassword();

            StreamReader objStreamReader           = new StreamReader(Parameterdetails);
            string       JsonStringForDeSerialized = objStreamReader.ReadToEnd();

            objStreamReader.Dispose();

            objChangePassword = JsonHelper.JsonDeserialize <ChangePassword>(JsonStringForDeSerialized);

            int    UserId      = objChangePassword.UserId;
            string OldPassowrd = objChangePassword.OldPassowrd;
            string NewPassword = objChangePassword.NewPassword;

            DataTable dt = new DataTable();

            cmd             = new SqlCommand();
            cmd.CommandText = @"SELECT COUNT(*) as TotalCount FROM Com_Login_Mst WHERE UserID ='" + UserId + "' AND Password ='******'";

            dt = objdatacommon.GetDataTableWithQuery(cmd);
            objChangePassword = new ChangePassword();
            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["TotalCount"].ToString() == "1" && UserId > 0)
                {
                    cmd = new SqlCommand();
                    cmd.Parameters.Add("@UserId", SqlDbType.Int).Value       = UserId;
                    cmd.Parameters.Add("@Password", SqlDbType.VarChar).Value = NewPassword;
                    cmd.Parameters.Add("@ModifiedBy", SqlDbType.Int).Value   = UserId;
                    cmd.Parameters.Add(new SqlParameter("@ErrorStatus", SqlDbType.VarChar, 10));
                    cmd.Parameters["@ErrorStatus"].Direction = ParameterDirection.Output;

                    cmd.CommandText = "SP_Update_In_Com_Login_Mst_ForPassword";
                    cmd             = objdatacommon.ExecuteSqlProcedure(cmd);

                    string ErrorStatus = cmd.Parameters["@ErrorStatus"].Value.ToString();
                    if (ErrorStatus == "0")
                    {
                        objChangePassword.ActiveStatus = "1";
                        objChangePassword.SaveMessage  = "Password has been updated successfully.";
                        objChangePassword.Type         = "status";
                    }
                    else
                    {
                        objChangePassword.ActiveStatus = "0";
                        objChangePassword.SaveMessage  = "Password has not been updated.";
                        objChangePassword.Type         = "warning";
                    }
                }
                else
                {
                    objChangePassword.ActiveStatus = "0";
                    objChangePassword.SaveMessage  = "Old password is wrong.";
                    objChangePassword.Type         = "error";
                }
            }

            string JsonStringForSerialized = JsonHelper.JsonSerializer <ChangePassword>(objChangePassword);

            return(JsonStringForSerialized);
        }
Exemplo n.º 20
0
 public async Task <IActionResult> ChangePassword([FromBody] ChangePassword command)
 => Json(await _userService.ChangePasswordAsync(UserId, command.CurrentPassword, command.NewPassword));
Exemplo n.º 21
0
        public BaseResponse ChangePassword(ChangePassword updatePassword)
        {
            if (updatePassword.password.Equals(updatePassword.newPassword))
            {
                return(new BaseResponse
                {
                    status = -4,
                    developerMessage = "Current password is same as old password"
                });
            }


            BaseResponse response = new BaseResponse();

            try
            {
                var db = _db;

                string encryptedPassword = Utils.EncryptionUtils.CreateMD5(updatePassword.password);
                var    obj = db.Users.SingleOrDefault(b => b.Id == updatePassword.userID && b.Password == encryptedPassword);
                if (obj != null)
                {
                    obj.Password = Utils.EncryptionUtils.CreateMD5(updatePassword.newPassword);
                    db.SaveChanges();
                    response.status = 1;
                }

                if (response.status == 1)
                {
                    string subject = Constant.CHANGE_PASSWORD_EMAIL_SUBJECT;
                    string body    = Constant.CHANGE_PASSWORD_EMAIL_BODY;
                    string address = obj.Email;

                    if (Utils.EmailUtils.sendEmail(subject, body, address))
                    {
                        response.status           = 1;
                        response.developerMessage = "Password changed successfully";
                    }
                    else
                    {
                        response.status           = -2;
                        response.developerMessage = "Failed to send email; SMTP Server Down";
                    }
                }

                else
                {
                    return(new BaseResponse
                    {
                        status = -3,
                        developerMessage = "Current Password is not Valid"
                    });
                }
            }
            catch (Exception e)
            {
                return(new BaseResponse
                {
                    status = -1,
                    developerMessage = "Something went wrong:" + e.Message
                });
            }

            return(response);
        }
Exemplo n.º 22
0
        public JsonResult OnPostChangePassword(ChangePassword command)
        {
            var result = _accountApplication.ChangePassword(command);

            return(new JsonResult(result));
        }
 public ChangePassword UnlockUserOnSuccess(ChangePassword objChangePassword)
 {
     // objChangePassword.Result = objUserManagementLogic.UnlockUserOnSuccess(objChangePassword);
     return(objChangePassword);
 }
Exemplo n.º 24
0
 public void UpdatePassword(ChangePassword command)
 {
     this.PasswordHash = command.PasswordHash;
     this.UpdateAt = command.CreateAt;
     this.UpdateBy = command.CreateBy;
 }
Exemplo n.º 25
0
 public async Task ChangePassword(ChangePassword input)
 {
     input.LoginID = this.session.LoginID;
     await this.authenticateService.ChangePassword(input);
 }
        public virtual async System.Threading.Tasks.Task <SessionResponse> changePasswordAsync(ChangePassword changePassword)
        {
            var request = new changePasswordRequest()
            {
                passport        = passport,
                applicationInfo = applicationInfo,
                partnerInfo     = partnerInfo,
                changePassword  = changePassword,
            };
            var response = await((NetSuitePortType)this).changePasswordAsync(request);

            return(response.sessionResponse);
        }
Exemplo n.º 27
0
        public async Task <IActionResult> Post([FromBody] ChangePassword command)
        {
            await _userService.ChangePassword(UserId, command.CurrentPassword, command.NewPassword);

            return(NoContent());
        }
Exemplo n.º 28
0
 public BaseResponse ChangePassword([FromBody] ChangePassword updatePassword)
 {
     return(new BLL.BLL_Users(_db).changePassword(updatePassword));
 }
Exemplo n.º 29
0
 public async Task <IActionResult> ChangePassword([FromBody] ChangePassword dto)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 30
0
 public async Task <IActionResult> ChangePassword([FromBody] ChangePassword command)
 => await ProcessCommand(command);
Exemplo n.º 31
0
 public async Task <ActionResult <User> > Reset(int id, ChangePassword ResetPassword)
 {
     return(await(this._repository as UserRepository).ResetPassword(id, ResetPassword));
 }
Exemplo n.º 32
0
        static public List <Button> CreateAdministrativoView()
        {
            var buttonList = new List <Button>();

            var menuButtonStyle = (Style)Application.Current.Resources["MenuButton"];
            var numRow          = 0;

            var HomeButton = new Button()
            {
                Name    = "HomeButton",
                Content = "Home",
                Style   = menuButtonStyle
            };

            buttonList.Add(HomeButton);
            Grid.SetRow(HomeButton, numRow);
            numRow++;

            var ChangePassButton = new Button()
            {
                Name    = "ChangePassButton",
                Content = "Cambiar Contraseña",
                Style   = menuButtonStyle
            };

            buttonList.Add(ChangePassButton);
            Grid.SetRow(ChangePassButton, numRow);
            numRow++;

            var BuscadorPersona = new Button()
            {
                Name    = "BuscadorPersona",
                Content = "Buscar Personas",
                Style   = menuButtonStyle
            };

            buttonList.Add(BuscadorPersona);
            Grid.SetRow(BuscadorPersona, numRow);
            numRow++;

            var FichaPersona = new Button()
            {
                Name    = "FichaPersona",
                Content = "Fichas Personales",
                Style   = menuButtonStyle
            };

            buttonList.Add(FichaPersona);
            Grid.SetRow(FichaPersona, numRow);
            numRow++;

            var FormCurso = new Button()
            {
                Name    = "FormCurso",
                Content = "Formularios Curso",
                Style   = menuButtonStyle
            };

            buttonList.Add(FormCurso);
            Grid.SetRow(FormCurso, numRow);
            numRow++;

            var FormAsignatura = new Button()
            {
                Name    = "FormAsignatura",
                Content = "Formularios Asignatura",
                Style   = menuButtonStyle
            };

            buttonList.Add(FormAsignatura);
            Grid.SetRow(FormAsignatura, numRow);
            numRow++;

            var FormAula = new Button()
            {
                Name    = "FormAula",
                Content = "Formularios Aula",
                Style   = menuButtonStyle
            };

            buttonList.Add(FormAula);
            Grid.SetRow(FormAula, numRow);
            numRow++;

            var FormDepartamento = new Button()
            {
                Name    = "FormDepartamento",
                Content = "Formularios Departamento",
                Style   = menuButtonStyle
            };

            buttonList.Add(FormDepartamento);
            Grid.SetRow(FormDepartamento, numRow);
            numRow++;

            var FormHorario = new Button()
            {
                Name    = "FormHorario",
                Content = "Formularios Horario",
                Style   = menuButtonStyle
            };

            buttonList.Add(FormHorario);
            Grid.SetRow(FormHorario, numRow);
            numRow++;

            var LogOutButton = new Button()
            {
                Name    = "LogOutButton",
                Content = "Salir",
                Style   = menuButtonStyle
            };

            buttonList.Add(LogOutButton);
            Grid.SetRow(LogOutButton, numRow);
            numRow++;

            void AdministrativoView_Click(object sender, RoutedEventArgs e)
            {
                if (sender is Button btnSender)
                {
                    if (btnSender == HomeButton)
                    {
                        var backUpMainPanel = XamlBridge.BackUpMainPanel;
                        XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel);
                        XamlBridge.MainPanelInstance = backUpMainPanel;
                    }
                    else if (btnSender == ChangePassButton)
                    {
                        var mainPanel = new ChangePassword().MainPanel;

                        XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, mainPanel);

                        XamlBridge.MainPanelInstance = mainPanel;
                    }
                    else if (btnSender == BuscadorPersona)
                    {
                        var backUpMainPanel = new BuscadorV2().MainPanel;
                        XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel);
                        XamlBridge.MainPanelInstance = backUpMainPanel;
                    }
                    else if (btnSender == FormCurso)
                    {
                        var backUpMainPanel = new FormularioCurso().MainPanel;
                        XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel);

                        XamlBridge.MainPanelInstance = backUpMainPanel;
                    }
                    else if (btnSender == FormAsignatura)
                    {
                        var backUpMainPanel = new FormularioAsignatura().MainPanel;
                        XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel);

                        XamlBridge.MainPanelInstance = backUpMainPanel;
                    }
                    else if (btnSender == FormAula)
                    {
                        var backUpMainPanel = new FormularioAula().MainPanel;
                        XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel);

                        XamlBridge.MainPanelInstance = backUpMainPanel;
                    }
                    else if (btnSender == FormDepartamento)
                    {
                        var backUpMainPanel = new FormularioDepartamento().MainPanel;
                        XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel);

                        XamlBridge.MainPanelInstance = backUpMainPanel;
                    }
                    else if (btnSender == FormHorario)
                    {
                        var backUpMainPanel = new FormularioHorario().MainPanel;
                        XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel);

                        XamlBridge.MainPanelInstance = backUpMainPanel;
                    }
                    else if (btnSender == FichaPersona)
                    {
                        var fichaPersona    = new FichaPersona();
                        var backUpMainPanel = fichaPersona.MainPanel;
                        XamlBridge.FichaPersona = fichaPersona;
                        fichaPersona.Close();
                        XamlFunctionality.ReplaceGrids(XamlBridge.MainPanelInstance, backUpMainPanel);

                        XamlBridge.MainPanelInstance = backUpMainPanel;
                    }
                    else if (btnSender == LogOutButton)
                    {
                        StaticButtonViews.LogOutFromMainWindow();
                    }
                }
            };

            foreach (var button in buttonList)
            {
                button.Click += new RoutedEventHandler(AdministrativoView_Click);
            }

            return(buttonList);
        }
Exemplo n.º 33
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            if (Page.IsPostBack)
            {
                ChangePassword changePassword = NamingContainer as ChangePassword;
                if (changePassword != null)
                {
                    Control container = changePassword.ChangePasswordTemplateContainer;
                    if (container != null)
                    {
                        CommandEventArgs cmdArgs   = null;
                        String[]         prefixes  = { "ChangePassword", "Cancel", "Continue" };
                        String[]         postfixes = { "PushButton", "Image", "Link" };
                        foreach (string prefix in prefixes)
                        {
                            foreach (string postfix in postfixes)
                            {
                                string  id   = prefix + postfix;
                                Control ctrl = container.FindControl(id);
                                if ((ctrl != null) && (!String.IsNullOrEmpty(Page.Request.Params.Get(ctrl.UniqueID))))
                                {
                                    switch (prefix)
                                    {
                                    case "ChangePassword":
                                        cmdArgs = new CommandEventArgs(ChangePassword.ChangePasswordButtonCommandName, this);
                                        break;

                                    case "Cancel":
                                        cmdArgs = new CommandEventArgs(ChangePassword.CancelButtonCommandName, this);
                                        break;

                                    case "Continue":
                                        cmdArgs = new CommandEventArgs(ChangePassword.ContinueButtonCommandName, this);
                                        break;
                                    }
                                    break;
                                }
                            }
                            if (cmdArgs != null)
                            {
                                break;
                            }
                        }

                        if ((cmdArgs != null) && (cmdArgs.CommandName == ChangePassword.ChangePasswordButtonCommandName))
                        {
                            Page.Validate();
                            if (!Page.IsValid)
                            {
                                cmdArgs = null;
                            }
                        }

                        if (cmdArgs != null)
                        {
                            RaiseBubbleEvent(this, cmdArgs);
                        }
                    }
                }
            }
        }
Exemplo n.º 34
0
        public ValidationResult GetValidationResult(ChangePassword model)
        {
            var validator = new ChangePasswordValidator(_repository);

            return(validator.Validate(model));
        }
Exemplo n.º 35
0
 public ActionResult ChangePassword(ChangePassword command)
 {
     return Handle(command, RedirectToAction("ChangePasswordSuccess"));
 }
 private void OnChangePassword(object sender, EventArgs e)
 {
     //TODO: Validate password
     changePassword += new ChangePassword(ChangePassword);
     alertWindow.OnChangePassword(changePassword, newPass, confirm, Activity);
 }
Exemplo n.º 37
0
 //change password
 private void tsmi_ChangePass_Click(object sender, EventArgs e)
 {
     ChangePassword ChangePass = new ChangePassword(userID, userName, pass);
     ChangePass.ShowDialog();
 }
Exemplo n.º 38
0
 private void menuChangePass_Click(object sender, EventArgs e)
 {
     ChangePassword frmChangePass = new ChangePassword();
     pnlMain.Controls.Clear();
     frmChangePass.ShowDialog();
 }
 public ChangePassword GetResendOTPInformation(ChangePassword objChangePassword, string UserName)
 {
     objChangePassword        = new ChangePassword();
     objChangePassword.Result = objUserManagementLogic.ResendOTPInformation(UserName);
     return(objChangePassword);
 }
Exemplo n.º 40
0
 public async Task<IHttpActionResult> ChangePassword(ChangePasswordVM vm)
 {
     bool match = _userSecurityService.VerifyPassword(UserId.Value, vm.Password);
     if (!match)
     {
         return BadRequest();
     }
     ChangePassword action = new ChangePassword(
         UserId.Value,DateTime.Now,UserId.Value, _userSecurityService.PasswordHash(UserId.Value, vm.NewPassword));
     ActionResponse actionResponse = await ActionBus.SendAsync<UserActionBase, ChangePassword>(action);
     return Ok(ActionResponseVM.ToVM(actionResponse));
 }
 public ChangePassword VerifyOTPInformation(ChangePassword objChangePassword)
 {
     objChangePassword.Result = objUserManagementLogic.VerifyOTPInformation(objChangePassword.OTP, objChangePassword.userName);
     return(objChangePassword);
 }
Exemplo n.º 42
0
 public ActionResult ChangePassword(ChangePassword command)
 {
     return Handle(command, () => RedirectToAction("ChangePasswordSuccess"), () => RedirectToAction("SignUp", "Account"));
 }