|
|
|
@ -157,15 +157,19 @@ pub async fn register_route( |
|
|
|
} |
|
|
|
} |
|
|
|
// Success!
|
|
|
|
// Success!
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
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()) |
|
|
|
.expect("we know this is valid"), |
|
|
|
.expect("we know this is valid"), |
|
|
|
"".into(), |
|
|
|
"".into(), |
|
|
|
&uiaainfo, |
|
|
|
&uiaainfo, |
|
|
|
&body.json_body.expect("body is json"), |
|
|
|
&json, |
|
|
|
)?; |
|
|
|
)?; |
|
|
|
return Err(Error::Uiaa(uiaainfo)); |
|
|
|
return Err(Error::Uiaa(uiaainfo)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json.")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -526,14 +530,14 @@ pub async fn change_password_route( |
|
|
|
} |
|
|
|
} |
|
|
|
// Success!
|
|
|
|
// Success!
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
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 |
|
|
|
&sender_user, |
|
|
|
.create(&sender_user, &sender_device, &uiaainfo, &json)?; |
|
|
|
&sender_device, |
|
|
|
|
|
|
|
&uiaainfo, |
|
|
|
|
|
|
|
&body.json_body.expect("body is json"), |
|
|
|
|
|
|
|
)?; |
|
|
|
|
|
|
|
return Err(Error::Uiaa(uiaainfo)); |
|
|
|
return Err(Error::Uiaa(uiaainfo)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json.")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
db.users |
|
|
|
db.users |
|
|
|
@ -618,14 +622,14 @@ pub async fn deactivate_route( |
|
|
|
} |
|
|
|
} |
|
|
|
// Success!
|
|
|
|
// Success!
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
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 |
|
|
|
&sender_user, |
|
|
|
.create(&sender_user, &sender_device, &uiaainfo, &json)?; |
|
|
|
&sender_device, |
|
|
|
|
|
|
|
&uiaainfo, |
|
|
|
|
|
|
|
&body.json_body.expect("body is json"), |
|
|
|
|
|
|
|
)?; |
|
|
|
|
|
|
|
return Err(Error::Uiaa(uiaainfo)); |
|
|
|
return Err(Error::Uiaa(uiaainfo)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json.")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Leave all joined rooms and reject all invitations
|
|
|
|
// Leave all joined rooms and reject all invitations
|
|
|
|
|