Improve error messages in join.rs

This commit is contained in:
0xf8 2023-06-21 16:52:39 -04:00
parent fd0fdb5f68
commit c1eeabc07c
Signed by: 0xf8
GPG Key ID: 446580D758689584

View File

@ -45,12 +45,12 @@ pub async fn join(mut req: Request<Database>) -> Result {
let Some(profile) = token.account.selected_profile.to_owned() else {
// No selected profile
return Err(YggdrasilError::new_unauthorized("Invalid token.").into())
return Err(YggdrasilError::new_base("Account has no profile.").into())
};
if body.profile_uuid != profile.uuid {
// UUID doesn't match
return Err(YggdrasilError::new_unauthorized("Invalid token.").into())
return Err(YggdrasilError::new_base("UUID doesn't match.").into())
}
Session::create(req.state(), &profile, body.server_id, req.remote().unwrap().to_string()).await?;