mirror of
https://github.com/openSUSE/osem.git
synced 2026-04-29 03:06:47 -04:00
57 lines
1.2 KiB
Ruby
57 lines
1.2 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
class RegistrationsController < Devise::RegistrationsController
|
|
prepend_before_action :check_captcha, only: [:create]
|
|
|
|
def edit
|
|
@openids = Openid.where(user_id: current_user.id).order(:provider)
|
|
super
|
|
end
|
|
|
|
def update
|
|
@openids = Openid.where(user_id: current_user.id).order(:provider)
|
|
super
|
|
end
|
|
|
|
protected
|
|
|
|
def after_update_path_for(resource)
|
|
edit_user_registration_path(resource)
|
|
end
|
|
|
|
def after_sign_up_path_for(resource)
|
|
edit_user_registration_path(resource)
|
|
end
|
|
|
|
private
|
|
|
|
def sign_up_params
|
|
params.require(:user).permit(
|
|
:email,
|
|
:password,
|
|
:password_confirmation,
|
|
:name,
|
|
:username
|
|
)
|
|
end
|
|
|
|
def account_update_params
|
|
params.require(:user).permit(
|
|
:email,
|
|
:password,
|
|
:password_confirmation,
|
|
:current_password,
|
|
:username,
|
|
:email_public
|
|
)
|
|
end
|
|
|
|
def check_captcha
|
|
unless Feature.inactive?(:recaptcha) || verify_recaptcha
|
|
self.resource = resource_class.new sign_up_params
|
|
resource.validate # Look for any other validation errors besides Recaptcha
|
|
respond_with_navigational(resource) { render :new }
|
|
end
|
|
end
|
|
end
|