예제 #1
0
        public ActionResult UpdateEmail(AccountViewModel model)
        {            
            var response = BlogService.UpdateEmail(((BlogUser)User).UserId.Value, model.EmailAddress, TemplatePickupUrl);

            Notification notification;
            if (response.Success)
            {
                notification = new Notification
                {
                    Type = NotificationType.Information,
                    Subject = "Email Confirmation Required",
                    Message = "In order to confirm your email address, a verification email has been sent to the address you provided."
                };
            }
            else
            {
                notification = new Notification
                {
                    Type = NotificationType.Error,
                    Subject = "Update Failed",
                    Message = "Your email address could not be updated; " + response.Message
                };
            }

            TempData.StoreNotification(notification);

            return RedirectToAction("Index");
        }
예제 #2
0
        public ActionResult Index()
        {
            if (!(User is BlogUser))
            {
                throw new HttpException(401, "Unauthorized");
            }

            var user = BlogService.GetUser(((BlogUser)User).UserId ?? 0);
            var viewModel = new AccountViewModel
            {
                EmailAddress = user.Email,
                EmailIsVerified = user.EmailIsVerified
            };

            return View(viewModel);
        }