Implemented refresh token

This commit is contained in:
Benjamin Sherriff
2023-10-18 16:05:10 -04:00
parent f072a47d22
commit e5f8d0b315
5 changed files with 124 additions and 30 deletions

View File

@@ -100,9 +100,8 @@ impl From<QueryUser> for ResponseUser {
#[derive(Debug, Serialize, Deserialize)]
pub struct JwtAuth {
pub access_token_uuid: uuid::Uuid,
pub email: String,
pub role: String,
pub token: uuid::Uuid,
pub user: ResponseUser
}
impl FromRequest for JwtAuth {
@@ -162,7 +161,7 @@ impl FromRequest for JwtAuth {
match QueryUser::get_by_email(&user_email) {
Ok(user) => {
ready(Ok(JwtAuth { access_token_uuid, email: user.email, role: user.role }))
ready(Ok(JwtAuth { token: access_token_uuid, user: user.into() }))
}
Err(err) => return ready(Err(ActixError::from(ServiceError {
status: 500,