Refactor sessions management
This commit is contained in:
@ -52,7 +52,7 @@ pub async fn login_route(users: web::Data<Addr<UsersActor>>,
|
||||
}
|
||||
|
||||
// Check if user is already authenticated
|
||||
if SessionIdentity::is_authenticated(&id) {
|
||||
if SessionIdentity(&id).is_authenticated() {
|
||||
return redirect_user("/");
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ pub async fn login_route(users: web::Data<Addr<UsersActor>>,
|
||||
|
||||
match response {
|
||||
LoginResult::Success(user) => {
|
||||
id.remember(SessionIdentity::from_user(&user).serialize());
|
||||
SessionIdentity(&id).set_user(&user);
|
||||
|
||||
return redirect_user("/");
|
||||
}
|
||||
|
Reference in New Issue
Block a user