public ActionResult Register(RegisterModel model) { try { model.RecaptchaSiteKey = SiteUtil.RecaptchaSiteKey; //if (!IsValidateReCaptcha()) //{ // ModelState.AddModelError("", "Google reCaptcha validation failed."); // return View(model); //} if (ModelState.IsValid) { // Check password format //if (!ValidatePassword(model.Password)) //{ // ModelState.AddModelError("Password", "The password is not correct format"); // return Json(new { Success = false, Message = "The password is not correct format" }); //} if (_loginRepository.GetQueryable().Any(n => n.Username == model.Username)) { //ModelState.AddModelError("", "Email has been used, " + // "please click forget password to reset your password"); return(Json(new { Success = false, Message = "Email has been used, please click forget password to reset your password" })); } //Disable mobile number for now var user = new SignUpPersonal() { FirstName = model.FirstName, LastName = model.LastName, MobileNumber = "", EmailAddress = model.Username, Password = model.Password, CountryCode = "", DialCode = "", EmailCode = Guid.NewGuid(), TermsConditionsAccepted = true }; // Save to database _signUpService.Register(user); // Send a verification email to user _emailService.SendMail(SiteUtil.WebsiteURL, SiteUtil.GmailAddress, model.Username, user.EmailCode, SiteUtil.EmailVerificationURL, SiteUtil.SenderName); // Send a new register notification to support _emailService.SendNewRegisterNotification(SiteUtil.SupportEmail, user); return(Json(new { Success = true })); } else { //ModelState.AddModelError("", "Data is not correct"); return(Json(new { Success = false, Message = "Data is not correct" })); } } catch (Exception x) { Logging.Error(x.Message, x); ModelState.AddModelError("", "Something went wrong, " + "our team has been notified with this error."); } return(Json(new { Success = false, Message = "Something went wrong, " + "our team has been notified with this error." })); }