Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] The possibility to disable new sign ups. #1592

Closed
1 task done
ektorasdj opened this issue Nov 25, 2023 · 10 comments · Fixed by #1922
Closed
1 task done

[Feature] The possibility to disable new sign ups. #1592

ektorasdj opened this issue Nov 25, 2023 · 10 comments · Fixed by #1922
Assignees
Labels
enhancement New feature or request needs triage Issues that need to be triaged v4 Issues related to the latest version

Comments

@ektorasdj
Copy link

Is there an existing issue for this feature?

  • Yes, I have searched the existing issues and it doesn't exist.

Feature Description

Hello and thank you for this great tool!
In reactive resume v3 i was able to stop new sign ups by using the env variable PUBLIC_FLAG_DISABLE_SIGNUPS=true (That way i could avoid unwanted users creating accounts).
Its not possible in version 4 right now.
I will really appriciate if you find some time to implement this in reactive resume v4.
Thank you!

@ektorasdj ektorasdj added enhancement New feature or request needs triage Issues that need to be triaged v4 Issues related to the latest version labels Nov 25, 2023
@ektorasdj
Copy link
Author

ektorasdj commented Nov 26, 2023

@AmruthPillai Hello, Thank you for looking into it and implementing it!
Unfortunately it still doesnt work for me.
I have updated the docker image to 4.0.2 and added the new env variable VITE_DISABLE_SIGNUPS=true but i am still able to create accounts like before.

@AmruthPillai
Copy link
Owner

Just out of curiosity, are you creating accounts with email or GitHub/Google?

When the env variable is set to true, it would basically show an alert on the register page that signups are disabled and also hides the email signup flow.

I tested it on the production instance too and works as expected, probably might need to pull and restart the services so that the new variables get refreshed.

@ektorasdj
Copy link
Author

ektorasdj commented Nov 26, 2023

I have disabled both google and github.
I just removed all volumes,images and containers and reinstalled - repulled reactive resume 4.0.2.
I can still create email accounts.
Here is my compose file where the word "sensitive" is my ip,pass or username (please ignore that)

version: "3.8"

# In this Docker Compose example, it assumes that you maintain a reverse proxy externally (or chose not to).
# The only two exposed ports here are from minio (:9000) and the app itself (:3000).
# If these ports are changed, ensure that the env vars passed to the app are also changed accordingly.

services:
  # Database (Postgres)
  postgres:
    image: postgres:15-alpine
    restart: unless-stopped
    volumes:
      - /volume1/docker/rxv4/postgres_data:/var/lib/postgresql/data:rw
      #- postgres_data:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: postgres
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
      interval: 10s
      timeout: 5s
      retries: 5

  # Storage (for image uploads)
  minio:
    image: minio/minio
    restart: unless-stopped
    command: server /data
    ports:
      - 8661:9000
    volumes:
      -  /volume1/docker/rxv4/minio_data:/data:rw
      #- minio_data:/data
    environment:
      MINIO_ROOT_USER: minioadmin
      MINIO_ROOT_PASSWORD: minioadmin

  # Chrome Browser (for printing and previews)
  chrome:
    image: browserless/chrome:1.61.0-puppeteer-21.4.1
    restart: unless-stopped
    environment:
      TOKEN: chrome_token
      EXIT_ON_HEALTH_FAILURE: true
      PRE_REQUEST_HEALTH_CHECK: true

  # Redis (for cache & server session management)
  redis:
    image: redis:alpine
    restart: unless-stopped
    command: redis-server --requirepass password

  app:
    image: amruthpillai/reactive-resume:latest
    restart: unless-stopped
    ports:
      - 8662:3000
    depends_on:
      - postgres
      - minio
      - redis
      - chrome
    environment:
      # -- Environment Variables --
      PORT: 3000
      NODE_ENV: production

      # -- URLs --      
      PUBLIC_URL: http://sensitive:8662
      STORAGE_URL: http://sensitive:8661


      # -- Printer (Chrome) --
      CHROME_TOKEN: chrome_token
      CHROME_URL: ws://chrome:3000

      # -- Database (Postgres) --
      DATABASE_URL: postgresql://postgres:postgres@postgres:5432/postgres

      # -- Auth --
      ACCESS_TOKEN_SECRET: access_token_secret
      REFRESH_TOKEN_SECRET: refresh_token_secret

      # -- Emails --
      MAIL_FROM: [email protected]
      SMTP_URL: smtp://[email protected]:[email protected]:587

      # -- Storage (Minio) --
      STORAGE_ENDPOINT: minio
      STORAGE_PORT: 9000
      STORAGE_REGION: us-east-1 # Optional
      STORAGE_BUCKET: default
      STORAGE_ACCESS_KEY: minioadmin
      STORAGE_SECRET_KEY: minioadmin
      STORAGE_USE_SSL: false

      # -- Cache (Redis) --
      REDIS_URL: redis://default:password@redis:6379

      # -- Sentry --
      # VITE_SENTRY_DSN: https://id.sentry.io # Optional

      # -- Crowdin (Optional) --
      # CROWDIN_PROJECT_ID:
      # CROWDIN_PERSONAL_TOKEN:

      # -- Email --
      #DISABLE_EMAIL_AUTH: true
      VITE_DISABLE_SIGNUPS: true
     
      # -- GitHub --
      #GITHUB_CLIENT_ID: github_client_id
      #GITHUB_CLIENT_SECRET: github_client_secret
      #GITHUB_CALLBACK_URL: http://localhost:3000/api/auth/github/callback

      # -- Google --
     # GOOGLE_CLIENT_ID: google_client_id
     # GOOGLE_CLIENT_SECRET: google_client_secret
     # GOOGLE_CALLBACK_URL: http://localhost:3000/api/auth/google/callback
  
#volumes:
  #minio_data:
  #postgres_data:

I am also attaching pictures of the login page, no alert.

Thank you
2023-11-26 19_17_42-Window
2023-11-26 19_17_47-Window

@ektorasdj
Copy link
Author

Hello! Did you maybe find anything wrong with my config?
I am still not able to disable signups even after repulling/recreating everything.
Thank you

@ValorVie
Copy link

ValorVie commented Dec 9, 2023

@ektorasdj @AmruthPillai
I also encountered the same issue, and according to my research, as explained on https://vitejs.dev/guide/env-and-mode.html, Vite applications behave differently when loading environment variables in NODE_ENV=production and NODE_ENV=development.

When NODE_ENV=production, the default environment variables during build time are not overridden by subsequent environment variable settings. I confirmed this behavior by adding ENV VITE_DISABLE_SIGNUPS="true" in the dockerfile during the Build Image stage.

However, when I set NODE_ENV=development, setting VITE_DISABLE_SIGNUPS="true" in docker-compose also works normally.

@mariushosting
Copy link

@AmruthPillai Same issue here.
Still not be able to disable user registration with the following environment:

VITE_DISABLE_SIGNUPS: true

@kgotso
Copy link
Contributor

kgotso commented Jan 21, 2024

@AmruthPillai i think based on the Vite limitation on only supporting build time variables, this should be exposed as a backend query. So at runtime the client should query the backend on whether or not sign up are allowed.

@Eurotimmy
Copy link

Hi @AmruthPillai, thank you for this app!
I can't disable the signup / create account by using "VITE_DISABLE_SIGNUPS: true" either.

@ValorVie
Copy link

For me, I just need to git clone this project, and then add the VITE_DISABLE_SIGNUPS="true" environment variable during the build stage in the Dockerfile. After using this modified Dockerfile to build the image, I can disable signup when NODE_ENV=production.

Dockerfile example
...
# --- Build Image ---
FROM base AS build

ENV NX_CLOUD_ACCESS_TOKEN=$NX_CLOUD_ACCESS_TOKEN
ENV VITE_DISABLE_SIGNUPS="true"

COPY .npmrc package.json pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile

COPY . .

RUN pnpm run build
...

@kiddalpha
Copy link

Any update on this? It's completely unusable if we can't disable public account creation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage Issues that need to be triaged v4 Issues related to the latest version
Projects
None yet
7 participants