Add single user mode
This commit is contained in:
parent
84d2371d6a
commit
1357c1cb3d
4 changed files with 25 additions and 8 deletions
|
@ -3,6 +3,7 @@
|
|||
class Auth::RegistrationsController < Devise::RegistrationsController
|
||||
layout 'auth'
|
||||
|
||||
before_action :check_single_user_mode
|
||||
before_action :configure_sign_up_params, only: [:create]
|
||||
|
||||
protected
|
||||
|
@ -21,4 +22,8 @@ class Auth::RegistrationsController < Devise::RegistrationsController
|
|||
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
|
||||
|
|
|
@ -5,15 +5,13 @@ class HomeController < ApplicationController
|
|||
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue