public ActionResult Index(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(View("Welcome"));
            }
            var user = RavenService.GetUser(RavenSession, name);

            if (user == null)
            {
                return(View("NewUser", new User {
                    UserName = name
                }));
            }
            var isAuthenticated = IsAuthenticated(user);

            if (user.IsPublic || isAuthenticated)
            {
                var challenges = RavenService.GetAllChallenges(RavenSession);
                var history    = RavenService.GetHistory(RavenSession, user);
                Thread.CurrentThread.CurrentCulture = new CultureInfo("sv-SE");
                var boardViewModel = new BoardViewModel
                {
                    Challenges      = challenges.Where(m => m.Hide == false).ToList(),
                    TotalPoints     = CalculatePoints(challenges, user),
                    CurrentUser     = user,
                    IsAuthenticated = isAuthenticated,
                    History         = history
                };
                return(View("Index", boardViewModel));
            }
            return(RedirectToAction("Index", "Authentication", new { name = user.UserName }));
        }
        public ActionResult Login(User user)
        {
            var userFromDatabase = RavenService.GetUser(RavenSession, user.UserName);

            if (user.Password != userFromDatabase.Password)
            {
                return(RedirectToAction("Index", new { name = user.UserName }));
            }


            var cookie = new HttpCookie("AuthID");

            cookie.Value   = userFromDatabase.AuthID;
            cookie.Expires = new DateTime(2020, 12, 31);
            Response.Cookies.Add(cookie);


            return(RedirectToAction("Index", "Home", new { name = user.UserName }));
        }