Skip to main content

SessionExt

Trait SessionExt 

Source
pub trait SessionExt {
    // Required methods
    fn session(&self) -> Session;
    fn logout_other_sessions(&self) -> impl Future<Output = Result<u64>> + Send;
    fn logout_all_sessions(
        &mut self,
    ) -> impl Future<Output = Result<u64>> + Send;

    // Provided methods
    fn flash(&self, key: impl Into<String>, value: impl Into<String>) { ... }
    fn flash_status(&self, msg: impl Into<String>) { ... }
    fn flash_errors(&self, errors: &Value) { ... }
    fn flash_old(&self, old: &Value) { ... }
}
Expand description

Convenient access to the request Session (empty session if the layer is absent).

Required Methods§

Source

fn session(&self) -> Session

Source

fn logout_other_sessions(&self) -> impl Future<Output = Result<u64>> + Send

Invalidate every other session for the bound user; keep the current cookie.

Requires Session::bind_user (done by Passport/Fortify login).

Source

fn logout_all_sessions(&mut self) -> impl Future<Output = Result<u64>> + Send

Invalidate all sessions for the bound user, including this one (clears cookie).

Provided Methods§

Source

fn flash(&self, key: impl Into<String>, value: impl Into<String>)

Source

fn flash_status(&self, msg: impl Into<String>)

Source

fn flash_errors(&self, errors: &Value)

Source

fn flash_old(&self, old: &Value)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl SessionExt for Request

Implementors§