public ActionResult SignIn(CombinationLoginRegisterModel model)
        {

            if (ModelState.IsValid)
            {
                if (model.Registring)
                {
                    if (!string.IsNullOrEmpty(model.ConfirmPassword))
                    {
                        try
                        {
                            if (model.Password == model.ConfirmPassword)
                            {
                                UserManagementRepository.CreateUser(model.Email, model.Password);
                                ViewBag.DisplayInfoMessage = true;
                                ViewBag.Message = "Bedankt voor uw registratie, er is een bevestigingsmail verstuurd naar " + model.Email;
                                return View(new CombinationLoginRegisterModel());
                            }
                            else
                            {
                                ModelState.AddModelError("", "De door u ingevoerde wachtwoorden komen niet overeen. Probeer het nogmaals.");
                            }
                        }
                        catch (MembershipCreateUserException e)
                        {
                            ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
                        }
                        ViewData.Add("HideMenu", true);
                        // If we got this far, something failed, redisplay form
                        return View(model);
                    }
                }
                else
                {
                    if (UserRepository.ValidateUser(model.Email, model.Password))
                    {
                        // establishes a principal, set the session cookie and redirects
                        // you can also pass additional claims to signin, which will be embedded in the session token
                        return SignIn(
                            model.Email,
                            AuthenticationMethods.Password,
                            model.ReturnUrl,
                            model.EnableSSO,
                            ConfigurationRepository.Global.SsoCookieLifetime);
                    }
                }
            }

            ModelState.AddModelError("", Resources.AccountController.IncorrectCredentialsNoAuthorization);

            //model.ShowClientCertificateLink = ConfigurationRepository.Global.EnableClientCertificateAuthentication;
            ViewData.Add("HideMenu", true);
            return View(model);
        }
        // shows the signin screen
        public ActionResult SignIn(string returnUrl, bool mobile = false)
        {
            // you can call AuthenticationHelper.GetRelyingPartyDetailsFromReturnUrl to get more information about the requested relying party
            if (WebSecurity.IsAuthenticated)
            {
                return RedirectToAction("MyProfile");
            }
            else
            {
                var vm = new CombinationLoginRegisterModel()
                {
                    ReturnUrl = returnUrl,
                    EnableSSO = true
                    //ShowClientCertificateLink = ConfigurationRepository.Global.EnableClientCertificateAuthentication
                };

                ViewData.Add("HideMenu", true);
                //if (mobile) vm.IsSigninRequest = true;
                return View(vm);
            }
        }