|
|
|
@ -156,20 +156,18 @@ pub async fn register_route(
|
|
|
|
|
return Err(Error::Uiaa(uiaainfo));
|
|
|
|
|
}
|
|
|
|
|
// Success!
|
|
|
|
|
} else if let Some(json) = body.json_body {
|
|
|
|
|
uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH));
|
|
|
|
|
db.uiaa.create(
|
|
|
|
|
&UserId::parse_with_server_name("", db.globals.server_name())
|
|
|
|
|
.expect("we know this is valid"),
|
|
|
|
|
"".into(),
|
|
|
|
|
&uiaainfo,
|
|
|
|
|
&json,
|
|
|
|
|
)?;
|
|
|
|
|
return Err(Error::Uiaa(uiaainfo));
|
|
|
|
|
} else {
|
|
|
|
|
if let Some(json) = body.json_body {
|
|
|
|
|
uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH));
|
|
|
|
|
db.uiaa.create(
|
|
|
|
|
&UserId::parse_with_server_name("", db.globals.server_name())
|
|
|
|
|
.expect("we know this is valid"),
|
|
|
|
|
"".into(),
|
|
|
|
|
&uiaainfo,
|
|
|
|
|
&json,
|
|
|
|
|
)?;
|
|
|
|
|
return Err(Error::Uiaa(uiaainfo));
|
|
|
|
|
} else {
|
|
|
|
|
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json."));
|
|
|
|
|
}
|
|
|
|
|
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json."));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -529,15 +527,13 @@ pub async fn change_password_route(
|
|
|
|
|
return Err(Error::Uiaa(uiaainfo));
|
|
|
|
|
}
|
|
|
|
|
// Success!
|
|
|
|
|
} else if let Some(json) = body.json_body {
|
|
|
|
|
uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH));
|
|
|
|
|
db.uiaa
|
|
|
|
|
.create(&sender_user, &sender_device, &uiaainfo, &json)?;
|
|
|
|
|
return Err(Error::Uiaa(uiaainfo));
|
|
|
|
|
} else {
|
|
|
|
|
if let Some(json) = body.json_body {
|
|
|
|
|
uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH));
|
|
|
|
|
db.uiaa
|
|
|
|
|
.create(&sender_user, &sender_device, &uiaainfo, &json)?;
|
|
|
|
|
return Err(Error::Uiaa(uiaainfo));
|
|
|
|
|
} else {
|
|
|
|
|
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json."));
|
|
|
|
|
}
|
|
|
|
|
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json."));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
db.users
|
|
|
|
@ -621,15 +617,13 @@ pub async fn deactivate_route(
|
|
|
|
|
return Err(Error::Uiaa(uiaainfo));
|
|
|
|
|
}
|
|
|
|
|
// Success!
|
|
|
|
|
} else if let Some(json) = body.json_body {
|
|
|
|
|
uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH));
|
|
|
|
|
db.uiaa
|
|
|
|
|
.create(&sender_user, &sender_device, &uiaainfo, &json)?;
|
|
|
|
|
return Err(Error::Uiaa(uiaainfo));
|
|
|
|
|
} else {
|
|
|
|
|
if let Some(json) = body.json_body {
|
|
|
|
|
uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH));
|
|
|
|
|
db.uiaa
|
|
|
|
|
.create(&sender_user, &sender_device, &uiaainfo, &json)?;
|
|
|
|
|
return Err(Error::Uiaa(uiaainfo));
|
|
|
|
|
} else {
|
|
|
|
|
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json."));
|
|
|
|
|
}
|
|
|
|
|
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json."));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Leave all joined rooms and reject all invitations
|
|
|
|
|