diff --git a/src/pages/login.rs b/src/pages/login.rs
index 253399c..f24bcba 100644
--- a/src/pages/login.rs
+++ b/src/pages/login.rs
@@ -3,6 +3,7 @@ use leptos::leptos_dom::*;
use leptos::*;
use leptos_icons::*;
use icondata;
+use crate::users::UserCredentials;
#[component]
pub fn Login() -> impl IntoView {
@@ -23,7 +24,12 @@ pub fn Login() -> impl IntoView {
let password1 = password.get();
spawn_local(async move {
- let login_result = login(username_or_email1, password1).await;
+ let user_credentials = UserCredentials {
+ username_or_email: username_or_email1,
+ password: password1
+ };
+
+ let login_result = login(user_credentials).await;
if let Err(err) = login_result {
// Handle the error here, e.g., log it or display to the user
log!("Error logging in: {:?}", err);
diff --git a/src/users.rs b/src/users.rs
index 62cd25b..e8084e2 100644
--- a/src/users.rs
+++ b/src/users.rs
@@ -69,10 +69,10 @@ pub async fn create_user(new_user: &User) -> Result<(), ServerFnError> {
/// Validate a user's credentials
/// Returns a Result with the user if the credentials are valid, None if not valid, or an error if there was a problem
#[cfg(feature = "ssr")]
-pub async fn validate_user(username_or_email: String, password: String) -> Result