Exemplo n.º 1
0
        /**
         * @NoAdminRequired
         * @UseSession
         *
         * @return RedirectResponse
         */
        public RedirectResponse logout()
        {
            var loginToken = this.request.getCookie("nc_token");

            if (loginToken != null)
            {
                this.config.deleteUserValue(this.userSession.getUser().getUID(), "login_token", loginToken);
            }

            this.userSession.logout();

            var response = new RedirectResponse(this.urlGenerator.linkToRouteAbsolute(
                                                    "core.login.showLoginForm", new Dictionary <string, object>()
            {
                { "clear", true }
            }
                                                    // this param the the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers
                                                    ));

            this.session.set("clearingExecutionContexts", "1");
            this.session.close();
            response.addHeader("Clear-Site-Data", "\"cache\", \"storage\"");
            return(response);
        }