public ActionResult logout()
 {
     Session.Clear();
     FormsAuthentication.SignOut();
     return(RedirectToAction("Index", "Login"));
 }
 public ActionResult Logout()
 {
     Session.Abandon();
     FormsAuthentication.SignOut();
     return(RedirectToAction("Login"));
 }
Example #3
0
 protected void ls1_LoggedOut(object sender, EventArgs e)
 {
     Session.Abandon();
     FormsAuthentication.SignOut();
 }
Example #4
0
 protected void LogoutBtn(object sender, EventArgs e)
 {
     FormsAuthentication.SignOut();
     Response.Redirect("HomePage.aspx");
 }
Example #5
0
 public ActionResult LogOff()
 {
     FormsAuthentication.SignOut();
     return(RedirectToAction("Index", "Home"));
 }
Example #6
0
 protected void btnLogout_Click(object sender, EventArgs e)
 {
     FormsAuthentication.SignOut();
     Response.Redirect("/Default.aspx");
 }
Example #7
0
        public ActionResult SignOut()
        {
            FormsAuthentication.SignOut();

            return(RedirectToAction("LoginRegistration"));
        }
Example #8
0
 //Cerrar Sesion
 public ActionResult Logout()
 {
     FormsAuthentication.SignOut();
     return(RedirectToAction("Login", "Account"));
 }
Example #9
0
 public virtual void SignOut()
 {
     _cachedUser = null;
     FormsAuthentication.SignOut();
 }
Example #10
0
        public ActionResult MemberRegisterLogic(RegisterViewModel userModel)
        {
            var forumReturnUrl = Settings.ForumRootUrl;
            var newMemberGroup = Settings.Group;

            if (userModel.ForumId != null && userModel.ForumId != Settings.ForumId)
            {
                var correctForum = Dialogue.Settings((int)userModel.ForumId);
                forumReturnUrl = correctForum.ForumRootUrl;
                newMemberGroup = correctForum.Group;
            }

            using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork())
            {
                // Secondly see if the email is banned
                if (ServiceFactory.BannedEmailService.EmailIsBanned(userModel.Email))
                {
                    ModelState.AddModelError(string.Empty, Lang("Error.EmailIsBanned"));

                    if (userModel.LoginType != LoginType.Standard)
                    {
                        ShowModelErrors();
                        return(Redirect(Settings.RegisterUrl));
                    }
                    return(CurrentUmbracoPage());
                }

                var userToSave = AppHelpers.UmbMemberHelper().CreateRegistrationModel(AppConstants.MemberTypeAlias);
                userToSave.Username        = ServiceFactory.BannedWordService.SanitiseBannedWords(userModel.UserName);
                userToSave.Name            = userToSave.Username;
                userToSave.UsernameIsEmail = false;
                userToSave.Email           = userModel.Email;
                userToSave.Password        = userModel.Password;

                var homeRedirect = false;

                MembershipCreateStatus createStatus;
                AppHelpers.UmbMemberHelper().RegisterMember(userToSave, out createStatus, false);

                if (createStatus != MembershipCreateStatus.Success)
                {
                    ModelState.AddModelError(string.Empty, ServiceFactory.MemberService.ErrorCodeToString(createStatus));
                }
                else
                {
                    // Get the umbraco member
                    var umbracoMember = AppHelpers.UmbServices().MemberService.GetByUsername(userToSave.Username);

                    // Set the role/group they should be in
                    AppHelpers.UmbServices().MemberService.AssignRole(umbracoMember.Id, newMemberGroup.Name);

                    // See if this is a social login and we have their profile pic
                    if (!string.IsNullOrEmpty(userModel.SocialProfileImageUrl))
                    {
                        // We have an image url - Need to save it to their profile
                        var image = AppHelpers.GetImageFromExternalUrl(userModel.SocialProfileImageUrl);

                        // Upload folder path for member
                        var uploadFolderPath = AppHelpers.GetMemberUploadPath(umbracoMember.Id);

                        // Upload the file
                        var uploadResult = AppHelpers.UploadFile(image, uploadFolderPath);

                        // Don't throw error if problem saving avatar, just don't save it.
                        if (uploadResult.UploadSuccessful)
                        {
                            umbracoMember.Properties[AppConstants.PropMemberAvatar].Value = string.Concat(VirtualPathUtility.ToAbsolute(AppConstants.UploadFolderPath), umbracoMember.Id, "/", uploadResult.UploadedFileName);
                        }
                    }

                    // Now check settings, see if users need to be manually authorised
                    // OR Does the user need to confirm their email
                    var manuallyAuthoriseMembers       = Settings.ManuallyAuthoriseNewMembers;
                    var memberEmailAuthorisationNeeded = Settings.NewMembersMustConfirmAccountsViaEmail;
                    if (manuallyAuthoriseMembers || memberEmailAuthorisationNeeded)
                    {
                        umbracoMember.IsApproved = false;
                    }

                    // Store access token for social media account in case we want to do anything with it
                    if (userModel.LoginType == LoginType.Facebook)
                    {
                        umbracoMember.Properties[AppConstants.PropMemberFacebookAccessToken].Value = userModel.UserAccessToken;
                    }
                    if (userModel.LoginType == LoginType.Google)
                    {
                        umbracoMember.Properties[AppConstants.PropMemberGoogleAccessToken].Value = userModel.UserAccessToken;
                    }

                    // Do a save on the member
                    AppHelpers.UmbServices().MemberService.Save(umbracoMember);

                    if (Settings.EmailAdminOnNewMemberSignup)
                    {
                        var sb = new StringBuilder();
                        sb.AppendFormat("<p>{0}</p>", string.Format(Lang("Members.NewMemberRegistered"), Settings.ForumName, Settings.ForumRootUrl));
                        sb.AppendFormat("<p>{0} - {1}</p>", userToSave.Username, userToSave.Email);
                        var email = new Email
                        {
                            EmailTo   = Settings.AdminEmailAddress,
                            EmailFrom = Settings.NotificationReplyEmailAddress,
                            NameTo    = Lang("Members.Admin"),
                            Subject   = Lang("Members.NewMemberSubject")
                        };
                        email.Body = ServiceFactory.EmailService.EmailTemplate(email.NameTo, sb.ToString());
                        ServiceFactory.EmailService.SendMail(email);
                    }

                    // Fire the activity Service
                    ServiceFactory.ActivityService.MemberJoined(MemberMapper.MapMember(umbracoMember));

                    var userMessage = new GenericMessageViewModel();

                    // Set the view bag message here
                    if (manuallyAuthoriseMembers)
                    {
                        userMessage.Message     = Lang("Members.NowRegisteredNeedApproval");
                        userMessage.MessageType = GenericMessages.Success;
                    }
                    else if (memberEmailAuthorisationNeeded)
                    {
                        userMessage.Message     = Lang("Members.MemberEmailAuthorisationNeeded");
                        userMessage.MessageType = GenericMessages.Success;
                    }
                    else
                    {
                        // If not manually authorise then log the user in
                        FormsAuthentication.SetAuthCookie(userToSave.Username, true);
                        userMessage.Message     = Lang("Members.NowRegistered");
                        userMessage.MessageType = GenericMessages.Success;
                    }

                    //Show the message
                    ShowMessage(userMessage);

                    if (!manuallyAuthoriseMembers && !memberEmailAuthorisationNeeded)
                    {
                        homeRedirect = true;
                    }

                    try
                    {
                        unitOfWork.Commit();

                        // Only send the email if the admin is not manually authorising emails or it's pointless
                        SendEmailConfirmationEmail(umbracoMember);

                        if (homeRedirect && !string.IsNullOrEmpty(forumReturnUrl))
                        {
                            if (Url.IsLocalUrl(userModel.ReturnUrl) && userModel.ReturnUrl.Length > 1 && userModel.ReturnUrl.StartsWith("/") &&
                                !userModel.ReturnUrl.StartsWith("//") && !userModel.ReturnUrl.StartsWith("/\\"))
                            {
                                return(Redirect(userModel.ReturnUrl));
                            }
                            return(Redirect(forumReturnUrl));
                        }
                    }
                    catch (Exception ex)
                    {
                        unitOfWork.Rollback();
                        LogError("Eror during member registering", ex);
                        FormsAuthentication.SignOut();
                        ModelState.AddModelError(string.Empty, ex.Message);
                    }
                }
                if (userModel.LoginType != LoginType.Standard)
                {
                    ShowModelErrors();
                    return(Redirect(Settings.RegisterUrl));
                }
                return(CurrentUmbracoPage());
            }
        }
 public ActionResult onSignOut_Click()
 {
     FormsAuthentication.SignOut();
     return(RedirectToAction("Index", "Login"));
 }
Example #12
0
 protected void btnSalir_Click(object sender, EventArgs e)
 {
     Session["Operario"] = null;
     FormsAuthentication.SignOut();
     FormsAuthentication.RedirectToLoginPage();
 }
Example #13
0
 protected void LogOut_Click(object sender, EventArgs e)
 {
     FormsAuthentication.SignOut();
     Session.Abandon();
     FormsAuthentication.RedirectToLoginPage();
 }
Example #14
0
 public ActionResult Logout()
 {
     FormsAuthentication.SignOut();
     return(RedirectToAction("Index", "Default"));
 }
Example #15
0
 public ActionResult LogOut()
 {
     FormsAuthentication.SignOut();
     return(RedirectToAction("Login", "User"));
 }
Example #16
0
        public ActionResult LogOut()
        {

            FormsAuthentication.SignOut();
            return Redirect("/Account/Login");
        }
Example #17
0
 public ActionResult LogOut()
 {
     FormsAuthentication.SignOut();
     return(RedirectToAction("HomePage", "Search", new { }));
 }
        public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            //////if (HttpContext.Current.Request.Headers["WINDOW_GUID"] + string.Empty == string.Empty)
            //////{
            //////    //HttpContext.Current.Session.Clear();
            //////    FormsAuthentication.SignOut();
            //////    HttpContext.Current.Response.Redirect("~/ErrorPages/SessionExpired.aspx?" + QueryStringHelper.QueryStringParamNames.SESSION_LOCKOUT_STRING.Description() + "=1", true);
            //////}
            //////else
            //////{
            //////    HttpContext.Current.Response.AddHeader("WINDOW_GUID", HttpContext.Current.Session["WINDOW_GUID"].ToString());
            //////}

            IHttpHandler page = null;

            var contnr = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];

            if (contnr != null)
            {
                FormsAuthenticationTicket tkt = FormsAuthentication.Decrypt(contnr.Value);
                var lastLoginBLL = new LastLoginBLL(tkt);
                try
                {
                    switch (lastLoginBLL.ValidateAuthTicket())
                    {
                    case SessionValidationResult.Valid:
                        page = ExecutePageAuthorization(requestContext);
                        break;

                    case SessionValidationResult.Session_Expired:
                        FormsAuthentication.SignOut();
                        int UserLockedOutIndicator = 0;
                        HttpContext.Current.Server.Transfer(string.Format("~/ErrorPages/SessionExpired.aspx?{0}={1}", QueryStringHelper.QueryStringParamNames.SESSION_LOCKOUT_STRING.Description(), UserLockedOutIndicator));
                        //HttpContext.Current.Response.Redirect(string.Format("~/ErrorPages/SessionExpired.aspx?{0}={1}", QueryStringHelper.QueryStringParamNames.SESSION_LOCKOUT_STRING.Description(), UserLockedOutIndicator), true);
                        break;

                    case SessionValidationResult.Session_Concurrent:
                        FormsAuthentication.SignOut();
                        int LockedOutIndicator = 1;
                        HttpContext.Current.Server.Transfer(string.Format("~/ErrorPages/SessionExpired.aspx?{0}={1}", QueryStringHelper.QueryStringParamNames.SESSION_LOCKOUT_STRING.Description(), LockedOutIndicator));
                        //HttpContext.Current.Response.Redirect(string.Format("~/ErrorPages/SessionExpired.aspx?{0}={1}", QueryStringHelper.QueryStringParamNames.SESSION_LOCKOUT_STRING.Description(), LockedOutIndicator), true);
                        break;

                    default:
                        FormsAuthentication.SignOut();
                        HttpContext.Current.Response.Redirect("~/Default.aspx", true);
                        break;
                    }
                }
                catch (Exception lastLoginEx)
                {
                    if (lastLoginEx is ShiptalkException)
                    {
                        throw lastLoginEx;
                    }
                }
            }
            else
            {
                HttpContext.Current.Response.Redirect("~/Default.aspx", true);
            }

            return(page);
        }
Example #19
0
 protected void LogoutBtn_Click(object sender, EventArgs e)
 {
     Response.Clear();
     FormsAuthentication.SignOut();
     Response.Redirect("../Default.aspx");
 }
 protected void cmdSignOut_ServerClick(object sender, System.EventArgs e)
 {
     FormsAuthentication.SignOut();
     FormsAuthentication.RedirectToLoginPage();
 }
Example #21
0
 public ActionResult Logout()
 {
     FormsAuthentication.SignOut();
     return(RedirectToRoute("home"));
 }
Example #22
0
 protected void LoginLink_OnClick(object sender, EventArgs e)
 {
     FormsAuthentication.SignOut();
     Response.Redirect("~/login.aspx");
 }
Example #23
0
 public ActionResult Logout()
 {
     FormsAuthentication.SignOut();
     return(Redirect("~/account/login"));
 }
Example #24
0
 public ActionResult Logout()
 {
     FormsAuthentication.SignOut();
     Session.Abandon(); // it will clear the session at the end of request
     return(RedirectToAction("Register"));
 }
Example #25
0
 public void SignOut()
 {
     FormsAuthentication.SignOut();
 }
 public ActionResult LogOff()
 {
     FormsAuthentication.SignOut();
     Session.Abandon();
     return(Redirect("/"));
 }
Example #27
0
 public ActionResult Logout()
 {
     FormsAuthentication.SignOut();
     Session.Abandon();
     return(RedirectToAction("Index", "Home"));
 }
Example #28
0
 public ActionResult Logout()
 {
     Session.Abandon();
     FormsAuthentication.SignOut();//hủy tất cả nhưng cookie
     return(RedirectToAction("Index", "Login"));
 }
Example #29
0
 protected void Page_Load(object sender, EventArgs e)
 {
     FormsAuthentication.SignOut();
     FormsAuthentication.RedirectToLoginPage();
 }
Example #30
0
 protected void ExitBtnClick(object sender, EventArgs e)
 {
     FormsAuthentication.SignOut();
     Response.Redirect("~/LoginPage.aspx");
 }