From 7b9bd0fd76983f03d03cabcab7393f0f3d81bddb Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Mon, 27 May 2024 06:19:17 +0000 Subject: [PATCH] [autofix.ci] apply automated fixes --- ee/tabby-schema/graphql/schema.graphql | 2 +- ee/tabby-schema/src/schema/auth.rs | 2 +- ee/tabby-schema/src/schema/mod.rs | 2 +- ee/tabby-webserver/src/service/auth.rs | 16 +++++++++++++--- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ee/tabby-schema/graphql/schema.graphql b/ee/tabby-schema/graphql/schema.graphql index a8d5bad796fe..173494111a42 100644 --- a/ee/tabby-schema/graphql/schema.graphql +++ b/ee/tabby-schema/graphql/schema.graphql @@ -363,7 +363,7 @@ type Mutation { updateUserRole(id: ID!, isAdmin: Boolean!): Boolean! uploadUserAvatarBase64(id: ID!, avatarBase64: String): Boolean! updateUserName(id: ID!, name: String!): Boolean! - register(name: String!, email: String!, password1: String!, password2: String!, invitationCode: String): RegisterResponse! + register(email: String!, password1: String!, password2: String!, invitationCode: String, name: String!): RegisterResponse! tokenAuth(email: String!, password: String!): TokenAuthResponse! verifyToken(token: String!): Boolean! refreshToken(refreshToken: String!): RefreshTokenResponse! diff --git a/ee/tabby-schema/src/schema/auth.rs b/ee/tabby-schema/src/schema/auth.rs index d2b20b1e9169..e0befb1ef13d 100644 --- a/ee/tabby-schema/src/schema/auth.rs +++ b/ee/tabby-schema/src/schema/auth.rs @@ -363,7 +363,7 @@ pub trait AuthenticationService: Send + Sync { email: String, password1: String, invitation_code: Option, - name: Option + name: Option, ) -> Result; async fn allow_self_signup(&self) -> Result; diff --git a/ee/tabby-schema/src/schema/mod.rs b/ee/tabby-schema/src/schema/mod.rs index 438409d1329f..da3f2b6defc6 100644 --- a/ee/tabby-schema/src/schema/mod.rs +++ b/ee/tabby-schema/src/schema/mod.rs @@ -834,7 +834,7 @@ impl Mutation { password1: String, password2: String, invitation_code: Option, - name: String + name: String, ) -> Result { let input = auth::RegisterInput { email, diff --git a/ee/tabby-webserver/src/service/auth.rs b/ee/tabby-webserver/src/service/auth.rs index 386a03082080..ccaba48b1265 100644 --- a/ee/tabby-webserver/src/service/auth.rs +++ b/ee/tabby-webserver/src/service/auth.rs @@ -61,7 +61,7 @@ impl AuthenticationService for AuthenticationServiceImpl { email: String, password: String, invitation_code: Option, - name: Option + name: Option, ) -> Result { let is_admin_initialized = self.is_admin_initialized().await?; if is_admin_initialized && is_demo_mode() { @@ -91,7 +91,12 @@ impl AuthenticationService for AuthenticationServiceImpl { .await? } else { self.db - .create_user(email.clone(), Some(pwd_hash), !is_admin_initialized, name.clone()) + .create_user( + email.clone(), + Some(pwd_hash), + !is_admin_initialized, + name.clone(), + ) .await? }; @@ -737,7 +742,12 @@ mod tests { async fn register_admin_user(service: &AuthenticationServiceImpl) -> RegisterResponse { service - .register(ADMIN_EMAIL.to_owned(), ADMIN_PASSWORD.to_owned(), None, None) + .register( + ADMIN_EMAIL.to_owned(), + ADMIN_PASSWORD.to_owned(), + None, + None, + ) .await .unwrap() }