public ActionResult UserProfile(Result <UserInfo> userInfo, string pass, string cPass) { userInfo.Data.Pass = pass; /*if (!ModelState.IsValid) * { * return View(userInfo); * }*/ if (!pass.Equals(cPass)) { return(Content("Password and Confirm Password Should be Matched")); } //userInfo.Data.Pass = pass; var result = UserInfoRepo.Save(userInfo.Data); if (result.HasError) { userInfo.HasError = true; userInfo.Message = result.Message; return(View(userInfo)); } return(RedirectToAction("Index")); }
public ActionResult UserRequests(int id, string type) { if (id != 0 && !string.IsNullOrEmpty(type) && type != "0") { try { var userRequest = UserRequestsRepo.LoadRequests().Data.FirstOrDefault(d => d.ID == id); var userInfo = new UserInfo() { Address = userRequest.Address, Email = userRequest.Email, Name = userRequest.Name, Password = userRequest.Password, UserName = userRequest.UserName, UserTypeID = Int32.Parse(type) }; UserInfoRepo.Save(userInfo); UserRequestsRepo.deleteRequest(id); new Thread(() => { Thread.CurrentThread.IsBackground = true; /* run your code here */ ForgotPassword.ConfirmationMail(userRequest.Email, userRequest.Name, "Your account has been created Successfully. Please go to the following link to continue.", userRequest.UserName, userRequest.Password); }).Start(); //TempData["ConfirmationMsg"] = "A confirmation mail has been sent"; } catch (Exception ex) { } } return(JavaScript("location.reload(true)")); }
public ActionResult Registration(RegistrationModel registrationModel) { if (!ModelState.IsValid) { return(View(registrationModel)); } MD5 md5 = MD5.Create(); byte[] bytes = System.Text.ASCIIEncoding.ASCII.GetBytes(registrationModel.CPass); byte[] hash = md5.ComputeHash(bytes); StringBuilder sb = new StringBuilder(); for (int i = 0; i < hash.Length; i++) { sb.Append(hash[i].ToString("X2")); } var Hashedpass = sb.ToString(); var companyInfo = new CompanyInfo() { CName = registrationModel.CName, TradeLicenseNo = registrationModel.TradeLicenseNo, Website = registrationModel.Website, CEmail = registrationModel.CEmail, PhnNumber = registrationModel.PhnNumber, Address = registrationModel.Address, City = registrationModel.City, Zip = registrationModel.Zip }; var userInfo = new UserInfo() { FirstName = registrationModel.FirstName, LastName = registrationModel.LastName, UEmail = registrationModel.UEmail, Pass = Hashedpass, TimeZone = registrationModel.TimeZone, PreferredRoe = registrationModel.PreferredRoe, UserTypeID = (int)EnumCollection.UserTypeEnum.Agent, AdminVerifyID = (int)EnumCollection.AdminVarifyEnum.NotAccept, CompanyInfo = companyInfo, }; var result = UserInfoRepo.Save(userInfo); if (result.HasError) { ViewBag.Error = result.Message; return(View(registrationModel)); } SendMail(registrationModel.CEmail); Session["uEmail"] = registrationModel.UEmail; return(RedirectToAction("Login")); }
public ActionResult Registration(RegistrationModel model) { if (!ModelState.IsValid) { return(View(model)); } var UserInfo = new UserInfo() { UserName = model.UserName, Name = model.Name, Email = model.Email, Password = model.Password, UserTypeID = (int)model.userTypeID }; var result = UserInfoRepo.Save(UserInfo); if (result.HasError) { ViewBag.Error = result.Message; return(View(model)); } return(RedirectToAction("Index", "Home")); }