Change: register/login no longer require ownership

Register/login used to require ownership of `instance`. This wasn't really necessary and has been changed.
This commit is contained in:
bitfl0wer 2023-11-22 18:48:37 +01:00
parent 9ad01cd227
commit e06edada1e
2 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,7 @@ impl Instance {
///
/// # Reference
/// See <https://docs.spacebar.chat/routes/#post-/auth/login/>
pub async fn login_account(mut self, login_schema: LoginSchema) -> ChorusResult<ChorusUser> {
pub async fn login_account(&mut self, login_schema: LoginSchema) -> ChorusResult<ChorusUser> {
let endpoint_url = self.urls.api.clone() + "/auth/login";
let chorus_request = ChorusRequest {
request: Client::new()

View File

@ -19,7 +19,7 @@ impl Instance {
/// # Reference
/// See <https://docs.spacebar.chat/routes/#post-/auth/register/>
pub async fn register_account(
mut self,
&mut self,
register_schema: RegisterSchema,
) -> ChorusResult<ChorusUser> {
let endpoint_url = self.urls.api.clone() + "/auth/register";
@ -43,7 +43,7 @@ impl Instance {
self.limits_information.as_mut().unwrap().ratelimits = shell.limits.unwrap();
}
let user_object = self.get_user(token.clone(), None).await.unwrap();
let settings = ChorusUser::get_settings(&token, &self.urls.api.clone(), &mut self).await?;
let settings = ChorusUser::get_settings(&token, &self.urls.api.clone(), self).await?;
let mut identify = GatewayIdentifyPayload::common();
let gateway: GatewayHandle = Gateway::spawn(self.urls.wss.clone()).await.unwrap();
identify.token = token.clone();