Exemple #1
0
        protected JsonResult SignOutLogic()
        {
            Response result;

            try {
                _usersExtensionsServices.SignOut();
                result = _utilsServices.GetResponse(ResponseType.Success);
            } catch (Exception ex) {
                result = _utilsServices.GetResponse(ResponseType.InvalidUser, ex.Message);
            }
            return(Json(result));
        }
        protected JsonResult SignOutLogic()
        {
            Response result;

            if (OrchardServices.WorkContext.CurrentUser == null || // if the User is null the SignOutLogic do nothing and returns Success because the user is effectively not logged in
                CsrfTokenHelper.DoesCsrfTokenMatchAuthToken())
            {
                try {
                    _usersExtensionsServices.SignOut();
                    result = UtilsServices.GetResponse(ResponseType.Success);
                }
                catch (Exception ex) {
                    result = UtilsServices.GetResponse(ResponseType.InvalidUser, ex.Message);
                }
            }
            else
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                return(Json(UtilsServices.GetResponse(ResponseType.InvalidXSRF)));
            }
            return(Json(result));
        }