Remove actix packages
Temporarily comment out login and authentication
This commit is contained in:
@ -66,8 +66,8 @@ fn NotFound() -> impl IntoView {
|
||||
{
|
||||
// this can be done inline because it's synchronous
|
||||
// if it were async, we'd use a server function
|
||||
let resp = expect_context::<leptos_actix::ResponseOptions>();
|
||||
resp.set_status(actix_web::http::StatusCode::NOT_FOUND);
|
||||
let resp = expect_context::<leptos_axum::ResponseOptions>();
|
||||
resp.set_status(axum::http::StatusCode::NOT_FOUND);
|
||||
}
|
||||
|
||||
view! {
|
||||
|
24
src/auth.rs
24
src/auth.rs
@ -9,9 +9,6 @@ use crate::models::User;
|
||||
pub async fn signup(new_user: User) -> Result<(), ServerFnError> {
|
||||
use crate::users::create_user;
|
||||
|
||||
use leptos_actix::extract;
|
||||
use actix_web::{HttpMessage, HttpRequest};
|
||||
use actix_identity::Identity;
|
||||
use leptos::server_fn::error::NoCustomError;
|
||||
|
||||
// Ensure the user has no id
|
||||
@ -23,7 +20,7 @@ pub async fn signup(new_user: User) -> Result<(), ServerFnError> {
|
||||
create_user(&new_user).await
|
||||
.map_err(|e| ServerFnError::<NoCustomError>::ServerError(format!("Error creating user: {}", e)))?;
|
||||
|
||||
match extract::<HttpRequest>().await {
|
||||
/*match extract::<HttpRequest>().await {
|
||||
Ok(request) => {
|
||||
match Identity::login(&request.extensions(), new_user.username.clone()) {
|
||||
Ok(_) => Ok(()),
|
||||
@ -31,7 +28,9 @@ pub async fn signup(new_user: User) -> Result<(), ServerFnError> {
|
||||
}
|
||||
},
|
||||
Err(e) => Err(ServerFnError::<NoCustomError>::ServerError(format!("Error getting request: {}", e))),
|
||||
}
|
||||
}*/
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Log a user in
|
||||
@ -40,9 +39,6 @@ pub async fn signup(new_user: User) -> Result<(), ServerFnError> {
|
||||
#[server(endpoint = "login")]
|
||||
pub async fn login(username_or_email: String, password: String) -> Result<bool, ServerFnError> {
|
||||
use crate::users::validate_user;
|
||||
use actix_web::{HttpMessage, HttpRequest};
|
||||
use actix_identity::Identity;
|
||||
use leptos_actix::extract;
|
||||
use leptos::server_fn::error::NoCustomError;
|
||||
|
||||
let possible_user = validate_user(username_or_email, password).await
|
||||
@ -53,7 +49,7 @@ pub async fn login(username_or_email: String, password: String) -> Result<bool,
|
||||
None => return Ok(false)
|
||||
};
|
||||
|
||||
match extract::<HttpRequest>().await {
|
||||
/*match extract::<HttpRequest>().await {
|
||||
Ok(request) => {
|
||||
match Identity::login(&request.extensions(), user.username.clone()) {
|
||||
Ok(_) => Ok(true),
|
||||
@ -61,22 +57,22 @@ pub async fn login(username_or_email: String, password: String) -> Result<bool,
|
||||
}
|
||||
}
|
||||
Err(e) => Err(ServerFnError::<NoCustomError>::ServerError(format!("Error getting request: {}", e))),
|
||||
}
|
||||
}*/
|
||||
|
||||
Ok(false)
|
||||
}
|
||||
|
||||
/// Log a user out
|
||||
/// Returns a Result with the error message if the user could not be logged out
|
||||
#[server(endpoint = "logout")]
|
||||
pub async fn logout() -> Result<(), ServerFnError> {
|
||||
use leptos_actix::extract;
|
||||
use actix_identity::Identity;
|
||||
use leptos::server_fn::error::NoCustomError;
|
||||
|
||||
match extract::<Option<Identity>>().await {
|
||||
/*match extract::<Option<Identity>>().await {
|
||||
Ok(Some(user)) => user.logout(),
|
||||
Ok(None) => {},
|
||||
Err(e) => return Err(ServerFnError::<NoCustomError>::ServerError(format!("Error getting user: {}", e))),
|
||||
};
|
||||
};*/
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user