forked from Roflin/gamenight
Fixes leave on the server and reworked login flow.
This commit is contained in:
@@ -6,7 +6,7 @@ use jsonwebtoken::{encode, Header, EncodingKey, decode, DecodingKey, Validation}
|
||||
use serde::{Serialize, Deserialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
use gamenight_database::{user::{get_user, Role, User}, DbPool};
|
||||
use gamenight_database::{user::{get_user, User}, DbPool};
|
||||
|
||||
use super::error::ApiError;
|
||||
|
||||
@@ -16,21 +16,18 @@ pub struct Claims {
|
||||
uid: Uuid
|
||||
}
|
||||
|
||||
pub struct AuthUser {
|
||||
pub id: Uuid,
|
||||
pub username: String,
|
||||
pub email: String,
|
||||
pub role: Role,
|
||||
}
|
||||
pub struct AuthUser(pub User);
|
||||
|
||||
// pub struct AuthUser {
|
||||
// pub id: Uuid,
|
||||
// pub username: String,
|
||||
// pub email: String,
|
||||
// pub role: Role,
|
||||
// }
|
||||
|
||||
impl From<User> for AuthUser {
|
||||
fn from(value: User) -> Self {
|
||||
Self{
|
||||
id: value.id,
|
||||
username: value.username,
|
||||
email: value.email,
|
||||
role: value.role,
|
||||
}
|
||||
Self(value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user