Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: check signin with sso

johnnyjoy966a108d5269
diff --git a/server/router/api/v1/auth_service.go b/server/router/api/v1/auth_service.go
index ed77f092d..8f3f11845 100644
--- a/server/router/api/v1/auth_service.go
+++ b/server/router/api/v1/auth_service.go
@@ -126,6 +126,16 @@ func (s *APIV1Service) SignInWithSSO(ctx context.Context, request *v1pb.SignInWi
return nil, status.Errorf(codes.Internal, "failed to get user, error: %v", err)
}
if user == nil {
+ // Check if the user is allowed to sign up.
+ workspaceGeneralSetting, err := s.Store.GetWorkspaceGeneralSetting(ctx)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get workspace general setting, error: %v", err)
+ }
+ if workspaceGeneralSetting.DisallowUserRegistration {
+ return nil, status.Errorf(codes.PermissionDenied, "user registration is not allowed")
+ }
+
+ // Create a new user with the user info from the identity provider.
userCreate := &store.User{
Username: userInfo.Identifier,
// The new signup user should be normal user by default.