1
0
mirror of https://github.com/actix/examples synced 2025-06-26 17:17:42 +02:00

chore: edition 2024

This commit is contained in:
Rob Ede
2025-03-11 01:42:01 +00:00
parent fed7127644
commit a7527d72f3
75 changed files with 249 additions and 254 deletions

View File

@ -1,7 +1,7 @@
[package]
name = "simple-auth-server"
version = "1.0.0"
edition = "2021"
edition.workspace = true
rust-version.workspace = true
[dependencies]
actix-identity.workspace = true
@ -20,5 +20,6 @@ rust-argon2 = "2"
serde_json.workspace = true
serde.workspace = true
sparklepost = "0.5"
temp-env.workspace = true
time.workspace = true
uuid.workspace = true

View File

@ -1,4 +1,4 @@
use actix_web::{error::ResponseError, HttpResponse};
use actix_web::{HttpResponse, error::ResponseError};
use derive_more::Display;
use diesel::result::{DatabaseErrorKind, Error as DBError};
use uuid::Error as ParseError;
@ -22,7 +22,7 @@ impl ResponseError for ServiceError {
ServiceError::InternalServerError => {
HttpResponse::InternalServerError().json("Internal Server Error, Please try later")
}
ServiceError::BadRequest(ref message) => HttpResponse::BadRequest().json(message),
ServiceError::BadRequest(message) => HttpResponse::BadRequest().json(message),
ServiceError::Unauthorized => HttpResponse::Unauthorized().json("Unauthorized"),
}
}

View File

@ -30,16 +30,14 @@ pub fn verify(hash: &str, password: &str) -> Result<bool, ServiceError> {
#[cfg(test)]
mod tests {
use std::env;
use actix_web::cookie::Key;
use super::SECRET_KEY;
#[test]
fn secret_key_default() {
env::remove_var("SECRET_KEY");
assert!(Key::try_from(SECRET_KEY.as_bytes()).is_ok());
temp_env::with_var("SECRET_KEY", None::<&str>, || {
assert!(Key::try_from(SECRET_KEY.as_bytes()).is_ok());
});
}
}