1
0
mirror of https://github.com/actix/examples synced 2024-11-23 14:31:07 +01:00

fix 'cannot move out of secret_key ...' error and 'unused import: rand::Rng ...' warning (#588)

This commit is contained in:
Christian Carnero 2022-11-23 18:31:10 -03:00 committed by GitHub
parent 8f924c4791
commit ba75611b57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,8 +3,6 @@ use actix_session::{storage::CookieSessionStore, SessionMiddleware};
use actix_web::{
cookie::Key, middleware, web, App, HttpMessage as _, HttpRequest, HttpResponse, HttpServer,
};
use rand::Rng;
async fn index(id: Identity) -> String {
format!(
"Hello {}",
@ -42,7 +40,7 @@ async fn main() -> std::io::Result<()> {
App::new()
.wrap(IdentityMiddleware::default())
.wrap(
SessionMiddleware::builder(CookieSessionStore::default(), secret_key)
SessionMiddleware::builder(CookieSessionStore::default(), secret_key.clone())
.cookie_name("auth-example".to_owned())
.cookie_secure(false)
.build(),