PAPERCLIP_SECRET=
SECRET_KEY_BASE=
+# Registrations
+# Single user mode will disable registrations and redirect frontpage to the first profile
+# SINGLE_USER_MODE=true
+# Prevent registrations with following e-mail domains
+# EMAIL_DOMAIN_BLACKLIST=example1.com|example2.de|etc
+
# E-mail configuration
SMTP_SERVER=smtp.mailgun.org
SMTP_PORT=587
# CDN_HOST=assets.example.com
# S3 (optional)
-S3_ENABLED=false
-S3_BUCKET=
-AWS_ACCESS_KEY_ID=
-AWS_SECRET_ACCESS_KEY=
-S3_REGION=
+# S3_ENABLED=true
+# S3_BUCKET=
+# AWS_ACCESS_KEY_ID=
+# AWS_SECRET_ACCESS_KEY=
+# S3_REGION=
+
+# Optional alias for S3 if you want to use Cloudfront or Cloudflare in front
+# S3_CLOUDFRONT_HOST=
class Auth::RegistrationsController < Devise::RegistrationsController
layout 'auth'
+ before_action :check_single_user_mode
before_action :configure_sign_up_params, only: [:create]
protected
def after_sign_up_path_for(_resource)
new_user_session_path
end
+
+ def check_single_user_mode
+ redirect_to root_path if Rails.configuration.x.single_user_mode
+ end
end
def index
@body_classes = 'app-body'
- @home = Feed.new(:home, current_user.account).get(20)
- @mentions = Feed.new(:mentions, current_user.account).get(20)
@token = find_or_create_access_token.token
end
private
def authenticate_user!
- redirect_to about_path unless user_signed_in?
+ redirect_to(Rails.configuration.x.single_user_mode ? account_path(Account.first) : about_path) unless user_signed_in?
end
def find_or_create_access_token
--- /dev/null
+# frozen_string_literal: true
+
+Rails.application.configure do
+ config.x.single_user_mode = ENV['SINGLE_USER_MODE'] == 'true'
+end