Newer
Older
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class RegistrationsController < Devise::RegistrationsController
before_filter :check_registrations_open!
@user = User.build(params[:user])
flash[:notice] = I18n.t 'registrations.create.success'
@user.seed_aspects
sign_in_and_redirect(:user, @user)
Rails.logger.info("event=registration status=successful user=#{@user.diaspora_handle}")
flash[:error] = @user.errors.full_messages.join(', ')
Rails.logger.info("event=registration status=failure errors='#{@user.errors.full_messages.join(', ')}'")
render :new
def new
super
end
private
def check_registrations_open!
if APP_CONFIG[:registrations_closed]
flash[:error] = t('registrations.closed')
redirect_to new_user_session_path