login_required

Attribute Macro login_required 

Source
#[login_required]
Expand description

inject an argument UserWrapAuth(UserWrap(user)): UserWrapAuth<User> into the function.

§Syntax

#[login_required(UserType,name="user")]

§Attributes

  • UserType - Define the variable type.
  • name="user" - Define the variable name.

§Example

#[login_required(User)]
async fn hello()->impl actix_web::Responder{
    user.is_actived(); //can access user:Rc<User>
    return "hello";
}