mirror of
https://github.com/actix/examples
synced 2025-06-26 09:17:41 +02:00
chore: edition 2024
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "actix-casbin-example"
|
||||
version = "1.0.0"
|
||||
edition = "2021"
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
actix-web.workspace = true
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "cookie-auth"
|
||||
version = "1.0.0"
|
||||
edition = "2021"
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
actix-web.workspace = true
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "cookie-session"
|
||||
version = "1.0.0"
|
||||
edition = "2021"
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
actix-web.workspace = true
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "redis-session-example"
|
||||
version = "1.0.0"
|
||||
edition = "2021"
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
actix-web.workspace = true
|
||||
|
@ -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
|
||||
|
@ -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"),
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user