// Logout logs the user out of their session
975373
func (s *SessionClient) Logout(ctx context.Context) error {
	return s.client.DaemonRoundTrip(ctx, "POST", "/logout", nil, nil, nil, nil)
}
274013
func logOutput() (logOutput io.Writer, err error) {
	logOutput = nil
	if os.Getenv(EnvLog) != "" && os.Getenv(EnvLog) != "0" {
		logOutput = os.Stderr

		if logPath := os.Getenv(EnvLogFile); logPath != "" {
			var err error
			logOutput, err = os.Create(logPath)
			if err != nil {
				return nil, err
			}
		} else {
			// no path; do a little light filtering to avoid double-dipping UI
			// calls.
			r, w := io.Pipe()
			scanner := bufio.NewScanner(r)
			go func(scanner *bufio.Scanner) {
				for scanner.Scan() {
					if strings.Contains(scanner.Text(), "ui:") {
						continue
					}
					os.Stderr.WriteString(fmt.Sprint(scanner.Text() + "\n"))
				}
			}(scanner)
			logOutput = w
		}
	}

	return
}
1054104
func go_logged_in(spSession unsafe.Pointer, spErr C.sp_error) {
	sessionCall(spSession, func(s *Session) {
		s.cbLoggedIn(spError(spErr))
	})
}
457737
func serviceLoggedOut(ctx context.Context, config Config) {
	if jManager, err := GetJournalManager(config); err == nil {
		jManager.shutdownExistingJournals(ctx)
	}
	config.ResetCaches()
	config.UserHistory().Clear()
	config.Chat().ClearCache()
	mdServer := config.MDServer()
	if mdServer != nil {
		mdServer.RefreshAuthToken(ctx)
	}
	bServer := config.BlockServer()
	if bServer != nil {
		bServer.RefreshAuthToken(ctx)
	}
	config.KBFSOps().ClearCachedFavorites(ctx)
	config.KBFSOps().PushStatusChange()

	// Clear any cached MD for all private TLFs, as they shouldn't be
	// readable by a logged out user.  We assume that a logged-out
	// call always comes before a logged-in call.
	config.KBFSOps().ClearPrivateFolderMD(ctx)
}
569834
func (c *ServerConn) Logout() error {
	_, _, err := c.cmd(StatusReady, "REIN")
	return err
}
506288
func (s *SSO) EndSession(w http.ResponseWriter, r *http.Request) {
	currentCookie, _ := r.Cookie(s.CookieConfig.Name)
	newCookie := &http.Cookie{
		Name:    s.CookieConfig.Name,
		Domain:  s.CookieConfig.Domain,
		Secure:  s.CookieConfig.Secure,
		MaxAge:  -1,
		Expires: time.Unix(1, 0),
		Value:   "LOGGED-OUT",
	}
	s.CrowdApp.InvalidateSession(currentCookie.Value)

	log.Printf("Got cookie to remove: %+v\n", currentCookie)
	log.Printf("Removal cookie: %+v\n", newCookie)
	http.SetCookie(w, newCookie)
}
947147
func (n *nessusImpl) Logout() error {
	if n.authCookie == "" {
		log.Println("Not logged in, nothing to do to logout...")
		return nil
	}
	if n.verbose {
		log.Println("Logout...")
	}

	if _, err := n.doRequest("DELETE", "/session", nil, []int{http.StatusOK}); err != nil {
		return err
	}
	n.authCookie = ""
	return nil
}
214850
func (c *LogoutController) Logout(ctx *app.LogoutLogoutContext) error {
	logoutRedirect, err := c.doLogout(ctx, ctx.Redirect, ctx.Referer)
	if err != nil {
		return err
	}

	ctx.ResponseData.Header().Set("Cache-Control", "no-cache")
	ctx.ResponseData.Header().Set("Location", logoutRedirect)
	return ctx.TemporaryRedirect()
}
250104
func (state *UserState) Login(w http.ResponseWriter, username string) error {
	state.SetLoggedIn(username)
	return state.SetUsernameCookie(w, username)
}
491156
func (n *RequestObserver) Leave() {
	if n.state.agent {
		// Don't log disconnections from the controller to the model.
		if !n.state.fromController {
			n.connLogger.Infof("agent disconnected: %s for %s", n.state.tag, n.state.model)
		}
		n.hub.Publish(apiserver.DisconnectTopic, apiserver.APIConnection{
			AgentTag:        n.state.tag,
			ControllerAgent: n.state.fromController,
			ModelUUID:       n.state.model,
			ConnectionID:    n.state.id,
		})
	}
	n.logger.Debugf(
		"[%X] %s API connection terminated after %v",
		n.state.id,
		n.state.tag,
		time.Since(n.state.websocketConnected),
	)
}
17686
func (c *Client) Login(ctx context.Context, user *url.Userinfo) error {
	req := internal.URL(c, internal.SessionPath).Request(http.MethodPost)

	if user != nil {
		if password, ok := user.Password(); ok {
			req.SetBasicAuth(user.Username(), password)
		}
	}

	return c.Do(ctx, req, nil)
}
1157061
func (f *Form) Logout(ctx web.Context) error {
	c := &http.Cookie{
		Name:   f.CookieName,
		MaxAge: -1,
	}
	ctx.SetCookie(c)
	return ctx.Redirect(f.DefaultURL)
}
35802
func (s *AuthenticationService) NewLogoutParams() *LogoutParams {
	p := &LogoutParams{}
	p.p = make(map[string]interface{})
	return p
}
726794
func LogSetOutputFunction(f LogOutputFunction, data interface{}) {
	ctx := &logOutputFunctionCtx{
		f: f,
		d: data,
	}

	C.LogSetOutputFunction(unsafe.Pointer(ctx))

	logOutputFunctionCache = f
	logOutputDataCache = data
}
350017
func (c *UserController) AnyLogout() {
	if c.isLoggedIn() {
		c.logout()
	}

	c.Ctx.Redirect("/user/login")
}
1300006
func (s LoginSession) Clear() error {
	req := &request{
		url: "https://www.reddit.com/api/clear_sessions",
		values: &url.Values{
			"curpass": {s.password},
			"uh":      {s.modhash},
		},
		useragent: s.useragent,
	}
	body, err := req.getResponse()
	if err != nil {
		return err
	}

	if !strings.Contains(body.String(), "all other sessions have been logged out") {
		return errors.New("failed to clear session")
	}
	return nil
}
73774
func (server *HTTPServer) AdminLogoutUser(c *m.ReqContext) Response {
	userID := c.ParamsInt64(":id")

	if c.UserId == userID {
		return Error(400, "You cannot logout yourself", nil)
	}

	return server.logoutUserFromAllDevicesInternal(c.Req.Context(), userID)
}