Improve error messages in join.rs
This commit is contained in:
parent
fd0fdb5f68
commit
c1eeabc07c
@ -45,12 +45,12 @@ pub async fn join(mut req: Request<Database>) -> Result {
|
|||||||
|
|
||||||
let Some(profile) = token.account.selected_profile.to_owned() else {
|
let Some(profile) = token.account.selected_profile.to_owned() else {
|
||||||
// No selected profile
|
// 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 {
|
if body.profile_uuid != profile.uuid {
|
||||||
// UUID doesn't match
|
// 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?;
|
Session::create(req.state(), &profile, body.server_id, req.remote().unwrap().to_string()).await?;
|
||||||
|
Loading…
Reference in New Issue
Block a user