public ActionResult ChnageUserApproval(LocalUser model) { var user = UserAdminService.ApprovalStatus(model); var feedback = ""; if (!model.IsApproved) { KaamShaam.Services.EmailService.SendEmail(user.Email, "User Account Status Changed - KamSham.Pk", user.FullName + " admin has deleted your account. Please review your account.\n Feedback : " + feedback); // sms is in DeleteUser method } else { KaamShaam.Services.EmailService.SendEmail(user.Email, "User Account Status Changed - KamSham.Pk", user.FullName + " we noticed that admin has updated your account status. Please review your account." + feedback); KaamShaam.Services.EmailService.SendSms(user.Mobile, "Your account status has been changed. Please visit https://kamsham.pk"); } if (!model.IsApproved) { AdminService.DeleteUser(new AspNetUser { Id = model.Id }, model.Feedback); } return(Json(true, JsonRequestBehavior.AllowGet)); }
public JsonResult UpdateSelfPassword(KaamShaam.AdminModels.LocalUser user) { var id = System.Web.HttpContext.Current.User.Identity.GetUserId(); user.Id = id; var result = ChangePassword(user); return(Json(true, JsonRequestBehavior.AllowGet)); }
public HttpResponseMessage ChangePassword(KaamShaam.AdminModels.LocalUser usermodel) { #region check if (usermodel == null || string.IsNullOrEmpty(usermodel.Id) || string.IsNullOrEmpty(usermodel.Password)) { return(Request.CreateResponse(HttpStatusCode.OK, new ApiResponseModel { Success = false, Message = "Data not mapped", Data = usermodel })); } if (usermodel.Password.Length < 5) { return(Request.CreateResponse(HttpStatusCode.OK, new ApiResponseModel { Success = false, Message = "Password minimum length must be 5", Data = usermodel })); } #endregion var localUsermanager = Request.GetOwinContext().GetUserManager <ApplicationUserManager>(); ApplicationUser user = localUsermanager.FindById(usermodel.Id); if (user == null) { return(Request.CreateResponse(HttpStatusCode.OK, new ApiResponseModel { Success = false, Message = "User not found!", Data = usermodel })); } user.PasswordHash = localUsermanager.PasswordHasher.HashPassword(usermodel.Password); var result = localUsermanager.Update(user); if (!result.Succeeded) { return(Request.CreateResponse(HttpStatusCode.OK, new ApiResponseModel { Success = false, Message = "Failed to update password", Data = usermodel })); } return(Request.CreateResponse(HttpStatusCode.OK, new ApiResponseModel { Success = true, Message = "Password updated", Data = usermodel })); }
public bool ChangePassword(KaamShaam.AdminModels.LocalUser usermodel) { var localUsermanager = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>(); ApplicationUser user = localUsermanager.FindById(usermodel.Id); if (user == null) { return(false); } user.PasswordHash = localUsermanager.PasswordHasher.HashPassword(usermodel.Password); var result = localUsermanager.Update(user); if (!result.Succeeded) { return(false); } return(true); }
public ActionResult ChnageVendorsApproval(LocalUser model) { UserAdminService.ApprovalStatus(model); return(Json(true, JsonRequestBehavior.AllowGet)); }