diff --git a/src/api/auth.rs b/src/api/auth.rs index c0b2de8..c27768b 100644 --- a/src/api/auth.rs +++ b/src/api/auth.rs @@ -131,7 +131,7 @@ pub async fn login( let row = match client .query_opt( - "SELECT id, username, email, password_hash, role, created_at FROM users WHERE username = $1", + "SELECT id, username, email, password_hash, role, created_at FROM users WHERE username = $1 OR email = $1", &[&username], ) .await diff --git a/src/pages/login.rs b/src/pages/login.rs index 6b5d1e3..d47063b 100644 --- a/src/pages/login.rs +++ b/src/pages/login.rs @@ -78,12 +78,12 @@ pub fn LoginPage() -> Element { div { class: "space-y-4", div { label { class: "block text-sm font-medium text-gray-700 dark:text-[#9b9c9d] mb-1", - "用户名" + "用户名 / 邮箱" } input { class: "w-full px-4 py-2 border border-gray-200 dark:border-[#333] rounded-lg bg-white dark:bg-[#2e2e33] text-gray-900 dark:text-[#dadadb] focus:outline-none focus:border-gray-400 dark:focus:border-gray-600", r#type: "text", - placeholder: "用户名", + placeholder: "用户名或邮箱", value: username(), oninput: move |e| username.set(e.value()), }