mirror of
https://github.com/actix/examples
synced 2024-12-18 00:13:57 +01:00
fix 'cannot move out of secret_key ...' error and 'unused import: rand::Rng ...' warning (#588)
This commit is contained in:
parent
8f924c4791
commit
ba75611b57
@ -3,8 +3,6 @@ use actix_session::{storage::CookieSessionStore, SessionMiddleware};
|
|||||||
use actix_web::{
|
use actix_web::{
|
||||||
cookie::Key, middleware, web, App, HttpMessage as _, HttpRequest, HttpResponse, HttpServer,
|
cookie::Key, middleware, web, App, HttpMessage as _, HttpRequest, HttpResponse, HttpServer,
|
||||||
};
|
};
|
||||||
use rand::Rng;
|
|
||||||
|
|
||||||
async fn index(id: Identity) -> String {
|
async fn index(id: Identity) -> String {
|
||||||
format!(
|
format!(
|
||||||
"Hello {}",
|
"Hello {}",
|
||||||
@ -42,7 +40,7 @@ async fn main() -> std::io::Result<()> {
|
|||||||
App::new()
|
App::new()
|
||||||
.wrap(IdentityMiddleware::default())
|
.wrap(IdentityMiddleware::default())
|
||||||
.wrap(
|
.wrap(
|
||||||
SessionMiddleware::builder(CookieSessionStore::default(), secret_key)
|
SessionMiddleware::builder(CookieSessionStore::default(), secret_key.clone())
|
||||||
.cookie_name("auth-example".to_owned())
|
.cookie_name("auth-example".to_owned())
|
||||||
.cookie_secure(false)
|
.cookie_secure(false)
|
||||||
.build(),
|
.build(),
|
||||||
|
Loading…
Reference in New Issue
Block a user