aboutsummaryrefslogtreecommitdiffstats
path: root/crates/rocie-server/src/api/set/no_auth
diff options
context:
space:
mode:
Diffstat (limited to 'crates/rocie-server/src/api/set/no_auth')
-rw-r--r--crates/rocie-server/src/api/set/no_auth/user.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/rocie-server/src/api/set/no_auth/user.rs b/crates/rocie-server/src/api/set/no_auth/user.rs
index 7acb482..7ca865c 100644
--- a/crates/rocie-server/src/api/set/no_auth/user.rs
+++ b/crates/rocie-server/src/api/set/no_auth/user.rs
@@ -14,8 +14,8 @@ use crate::{
#[derive(ToSchema, Deserialize, Serialize)]
struct LoginInfo {
- /// The id of the user.
- id: UserId,
+ /// The user name of the user.
+ user_name: String,
/// The password of the user.
password: String,
@@ -30,7 +30,7 @@ struct LoginInfo {
),
(
status = NOT_FOUND,
- description = "User id not found"
+ description = "User name not found"
),
(
status = FORBIDDEN,
@@ -52,9 +52,9 @@ async fn login(
) -> Result<impl Responder> {
let info = info.into_inner();
- if let Some(user) = User::from_id(&app, info.id).await? {
+ if let Some(user) = User::from_name(&app, info.user_name).await? {
if user.password_hash.verify(&info.password) {
- Identity::login(&request.extensions(), info.id.to_string())?;
+ Identity::login(&request.extensions(), user.id.to_string())?;
Ok(HttpResponse::Ok().finish())
} else {
Ok(HttpResponse::Forbidden().finish())