public virtual ActionResult LoginForm(string view = "")
        {
            var model = new LoginModel {
                RememberMe = true
            };

            return(view.IsNullOrWhiteSpace() ? PartialView(model) : PartialView(view, model));
        }
        public virtual ActionResult Login(LoginModel model)
        {
            if (!ModelState.IsValid)
            {
                return(CurrentUmbracoPage());
            }

            if (!Members.Login(model.Username, model.Password))
            {
                var member = Members.GetByUsername(model.Username);

                var viewData = new StoreViewData {
                    Success = false
                };

                if (member == null)
                {
                    viewData.Messages = new[] { "Account does not exist for this email address." };
                }
                else
                {
                    var messages = new List <string>
                    {
                        "Login was unsuccessful with the email address and password entered."
                    };

                    if (!member.GetPropertyValue <bool>("umbracoMemberApproved"))
                    {
                        messages.Add("This account has not been approved.");
                    }
                    if (member.GetPropertyValue <bool>("umbracoMemberLockedOut"))
                    {
                        messages.Add("This account has been locked due to too many unsucessful login attempts.");
                    }

                    viewData.Messages = messages;
                }

                ViewData["MerchelloViewData"] = viewData;
                return(CurrentUmbracoPage());
            }

            return(model.SuccessRedirectUrl.IsNullOrWhiteSpace() ?
                   Redirect("/") : Redirect(model.SuccessRedirectUrl));
        }
 public virtual ActionResult LoginForm(string view = "")
 {
     var model = new LoginModel { RememberMe = true };
     return view.IsNullOrWhiteSpace() ? PartialView(model) : PartialView(view, model);
 }
        public virtual ActionResult Login(LoginModel model)
        {
            if (!ModelState.IsValid) return CurrentUmbracoPage();

            if (!Members.Login(model.Username, model.Password))
            {
                var member = Members.GetByUsername(model.Username);

                var viewData = new StoreViewData { Success = false };

                if (member == null)
                {
                    viewData.Messages = new[] { "Account does not exist for this email address." };
                }
                else
                {
                    var messages = new List<string>
                    {
                        "Login was unsuccessful with the email address and password entered."
                    };

                    if (!member.GetPropertyValue<bool>("umbracoMemberApproved")) messages.Add("This account has not been approved.");
                    if (member.GetPropertyValue<bool>("umbracoMemberLockedOut")) messages.Add("This account has been locked due to too many unsucessful login attempts.");

                    viewData.Messages = messages;
                }

                ViewData["MerchelloViewData"] = viewData;
                return CurrentUmbracoPage();
            }

            return model.SuccessRedirectUrl.IsNullOrWhiteSpace() ?
                Redirect("/") : Redirect(model.SuccessRedirectUrl);
        }