Exemplo n.º 1
0
        public ActionResult AddPhoneNumber(string email)
        {
            ResentCodeModel resentCodeModel = new ResentCodeModel();

            resentCodeModel.email = email;
            return(View(resentCodeModel));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> AddPhoneNumber(ResentCodeModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var user = await UserManager.FindByNameAsync(model.email);

            if (user != null)
            {
                model.userID = user.Id;
            }
            // Generate the token and send it

            //              var code = await UserManager.GenerateChangePhoneNumberTokenAsync(model.userID, model.PhoneNumber);
            bool smsNotifications = true;

            if (smsNotifications)
            {
                var smscode = await UserManager.GenerateChangePhoneNumberTokenAsync(user.Id, model.PhoneNumber);

                // FB added
                smsMGT smg           = new smsMGT();
                string messagestring = "Your security code for Silent Auction is: " + smscode;
                var    res           = smg.SendSingleSMS("1", model.PhoneNumber, messagestring);
                if (res != "success")
                {
                    string    EmailSubject = "OTP SMS NOT sent successfully";
                    string    EMailBody    = $"OTP SMS NOT sent successfully to customer {user.CompanyName}" + " to change phone " + ".  Error = " + res;
                    sendEmail sm           = new sendEmail();
                    string    emalres      = sm.SendEmailFB("*****@*****.**", EmailSubject, EMailBody, null, null);
                    ViewBag.errorMessage = "Cell Phone number not correct. Log in and provide correct number or contact NWWT at [email protected]";
                    return(View("Error"));
                }
            }

            return(RedirectToAction("VerifyPhoneNumber", new { PhoneNumber = model.PhoneNumber, id = user.Id }));
        }