|
|
@ -156,8 +156,7 @@ pub async fn register_route(
|
|
|
|
return Err(Error::Uiaa(uiaainfo));
|
|
|
|
return Err(Error::Uiaa(uiaainfo));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Success!
|
|
|
|
// Success!
|
|
|
|
} else {
|
|
|
|
} else if let Some(json) = body.json_body {
|
|
|
|
if let Some(json) = body.json_body {
|
|
|
|
|
|
|
|
uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH));
|
|
|
|
uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH));
|
|
|
|
db.uiaa.create(
|
|
|
|
db.uiaa.create(
|
|
|
|
&UserId::parse_with_server_name("", db.globals.server_name())
|
|
|
|
&UserId::parse_with_server_name("", db.globals.server_name())
|
|
|
@ -171,7 +170,6 @@ pub async fn register_route(
|
|
|
|
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json."));
|
|
|
|
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json."));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if missing_username {
|
|
|
|
if missing_username {
|
|
|
|
return Err(Error::BadRequest(
|
|
|
|
return Err(Error::BadRequest(
|
|
|
@ -529,8 +527,7 @@ pub async fn change_password_route(
|
|
|
|
return Err(Error::Uiaa(uiaainfo));
|
|
|
|
return Err(Error::Uiaa(uiaainfo));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Success!
|
|
|
|
// Success!
|
|
|
|
} else {
|
|
|
|
} else if let Some(json) = body.json_body {
|
|
|
|
if let Some(json) = body.json_body {
|
|
|
|
|
|
|
|
uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH));
|
|
|
|
uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH));
|
|
|
|
db.uiaa
|
|
|
|
db.uiaa
|
|
|
|
.create(&sender_user, &sender_device, &uiaainfo, &json)?;
|
|
|
|
.create(&sender_user, &sender_device, &uiaainfo, &json)?;
|
|
|
@ -538,7 +535,6 @@ pub async fn change_password_route(
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json."));
|
|
|
|
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json."));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db.users
|
|
|
|
db.users
|
|
|
|
.set_password(&sender_user, Some(&body.new_password))?;
|
|
|
|
.set_password(&sender_user, Some(&body.new_password))?;
|
|
|
@ -621,8 +617,7 @@ pub async fn deactivate_route(
|
|
|
|
return Err(Error::Uiaa(uiaainfo));
|
|
|
|
return Err(Error::Uiaa(uiaainfo));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Success!
|
|
|
|
// Success!
|
|
|
|
} else {
|
|
|
|
} else if let Some(json) = body.json_body {
|
|
|
|
if let Some(json) = body.json_body {
|
|
|
|
|
|
|
|
uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH));
|
|
|
|
uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH));
|
|
|
|
db.uiaa
|
|
|
|
db.uiaa
|
|
|
|
.create(&sender_user, &sender_device, &uiaainfo, &json)?;
|
|
|
|
.create(&sender_user, &sender_device, &uiaainfo, &json)?;
|
|
|
@ -630,7 +625,6 @@ pub async fn deactivate_route(
|
|
|
|
} else {
|
|
|
|
} 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
|
|
|
|
// Leave all joined rooms and reject all invitations
|
|
|
|
for room_id in db.rooms.rooms_joined(&sender_user).chain(
|
|
|
|
for room_id in db.rooms.rooms_joined(&sender_user).chain(
|
|
|
|