public virtual ActionResult Confirm(string username, string token)
        {
            // We don't want Login to have us as a return URL
            // By having this value present in the dictionary BUT null, we don't put "returnUrl" on the Login link at all
            ViewData[Constants.ReturnUrlViewDataKey] = null;

            if (String.IsNullOrEmpty(token))
            {
                return(HttpNotFound());
            }
            var user = UserService.FindByUsername(username);

            if (user == null)
            {
                return(HttpNotFound());
            }

            string existingEmail = user.EmailAddress;
            var    model         = new EmailConfirmationModel
            {
                ConfirmingNewAccount   = String.IsNullOrEmpty(existingEmail),
                SuccessfulConfirmation = UserService.ConfirmEmailAddress(user, token)
            };

            // SuccessfulConfirmation is required so that the confirm Action isn't a way to spam people.
            // Change notice not required for new accounts.
            if (model.SuccessfulConfirmation && !model.ConfirmingNewAccount)
            {
                MessageService.SendEmailChangeNoticeToPreviousEmailAddress(user, existingEmail);
            }
            return(View(model));
        }
        public virtual ActionResult Confirm(string username, string token)
        {
            if (String.IsNullOrEmpty(token))
            {
                return(HttpNotFound());
            }
            var user = _userService.FindByUsername(username);

            if (user == null)
            {
                return(HttpNotFound());
            }

            string existingEmail = user.EmailAddress;
            var    model         = new EmailConfirmationModel
            {
                ConfirmingNewAccount   = String.IsNullOrEmpty(existingEmail),
                SuccessfulConfirmation = _userService.ConfirmEmailAddress(user, token)
            };

            if (!model.ConfirmingNewAccount)
            {
                _messageService.SendEmailChangeNoticeToPreviousEmailAddress(user, existingEmail);
            }
            return(View(model));
        }
 public virtual ActionResult Thanks()
 {
     if (_settings.ConfirmEmailAddresses)
     {
         return(View());
     }
     else
     {
         var model = new EmailConfirmationModel {
             SuccessfulConfirmation = true, ConfirmingNewAccount = true
         };
         return(View("Confirm", model));
     }
 }
Beispiel #4
0
 public virtual ActionResult Thanks()
 {
     if (settings.ConfirmEmailAddresses)
     {
         return(View("~/Views/Users/Thanks.cshtml"));
     }
     else
     {
         var model = new EmailConfirmationModel {
             SuccessfulConfirmation = true, ConfirmingNewAccount = true
         };
         return(View("~/Views/Users/Confirm.cshtml", model));
     }
 }
        public virtual ActionResult Thanks()
        {
            // No need to redirect here after someone logs in...
            // By having this value present in the dictionary BUT null, we don't put "returnUrl" on the Login link at all
            ViewData[Constants.ReturnUrlViewDataKey] = null;

            if (Config.ConfirmEmailAddresses)
            {
                return(View());
            }
            else
            {
                var model = new EmailConfirmationModel {
                    SuccessfulConfirmation = true, ConfirmingNewAccount = true
                };
                return(View("Confirm", model));
            }
        }
        public virtual ActionResult Confirm(string username, string token)
        {
            if (String.IsNullOrEmpty(token))
            {
                return HttpNotFound();
            }
            var user = _userService.FindByUsername(username);
            if (user == null)
            {
                return HttpNotFound();
            }

            string existingEmail = user.EmailAddress;
            var model = new EmailConfirmationModel
                {
                    ConfirmingNewAccount = String.IsNullOrEmpty(existingEmail),
                    SuccessfulConfirmation = _userService.ConfirmEmailAddress(user, token)
                };

            if (!model.ConfirmingNewAccount)
            {
                _messageService.SendEmailChangeNoticeToPreviousEmailAddress(user, existingEmail);
            }
            return View(model);
        }
 public virtual ActionResult Thanks()
 {
     if (_settings.ConfirmEmailAddresses)
     {
         return View();
     }
     else
     {
         var model = new EmailConfirmationModel { SuccessfulConfirmation = true, ConfirmingNewAccount = true };
         return View("Confirm", model);
     }
 }
        public virtual ActionResult Confirm(string username, string token)
        {
            // We don't want Login to have us as a return URL
            // By having this value present in the dictionary BUT null, we don't put "returnUrl" on the Login link at all
            ViewData[Constants.ReturnUrlViewDataKey] = null;
            
            if (String.IsNullOrEmpty(token))
            {
                return HttpNotFound();
            }
            var user = _userService.FindByUsername(username);
            if (user == null)
            {
                return HttpNotFound();
            }

            string existingEmail = user.EmailAddress;
            var model = new EmailConfirmationModel
                {
                    ConfirmingNewAccount = String.IsNullOrEmpty(existingEmail),
                    SuccessfulConfirmation = _userService.ConfirmEmailAddress(user, token)
                };

            // SuccessfulConfirmation is required so that the confirm Action isn't a way to spam people.
            // Change notice not required for new accounts.
            if (model.SuccessfulConfirmation && !model.ConfirmingNewAccount)
            {
                _messageService.SendEmailChangeNoticeToPreviousEmailAddress(user, existingEmail);
            }
            return View(model);
        }
 public virtual ActionResult Thanks()
 {
     // No need to redirect here after someone logs in...
     // By having this value present in the dictionary BUT null, we don't put "returnUrl" on the Login link at all
     ViewData[Constants.ReturnUrlViewDataKey] = null;
     
     if (_config.ConfirmEmailAddresses)
     {
         return View();
     }
     else
     {
         var model = new EmailConfirmationModel { SuccessfulConfirmation = true, ConfirmingNewAccount = true };
         return View("Confirm", model);
     }
 }
 public virtual ActionResult Thanks()
 {
     if (settings.ConfirmEmailAddresses)
     {
         return View("~/Views/Users/Thanks.cshtml");
     }
     else
     {
         var model = new EmailConfirmationModel { SuccessfulConfirmation = true, ConfirmingNewAccount = true };
         return View("~/Views/Users/Confirm.cshtml", model);
     }
 }
        public virtual ActionResult Confirm(string username, string token)
        {
            if (String.IsNullOrEmpty(token))
            {
                return HttpNotFound();
            }
            var user = _userService.FindByUsername(username);
            if (user == null)
            {
                return HttpNotFound();
            }

            string existingEmail = user.EmailAddress;
            var model = new EmailConfirmationModel
                {
                    ConfirmingNewAccount = String.IsNullOrEmpty(existingEmail),
                    SuccessfulConfirmation = _userService.ConfirmEmailAddress(user, token)
                };

            // SuccessfulConfirmation is required so that the confirm Action isn't a way to spam people.
            // Change notice not required for new accounts.
            if (model.SuccessfulConfirmation && !model.ConfirmingNewAccount)
            {
                _messageService.SendEmailChangeNoticeToPreviousEmailAddress(user, existingEmail);
            }
            return View(model);
        }