2013-01-07 09:04:09 +01:00
|
|
|
class RegistrationsController < Devise::RegistrationsController
|
2017-11-03 17:41:26 -07:00
|
|
|
prepend_before_action :check_captcha, only: [:create]
|
2014-05-16 20:31:41 +02:00
|
|
|
|
2014-06-18 16:58:30 +03:00
|
|
|
def edit
|
|
|
|
|
@openids = Openid.where(user_id: current_user.id).order(:provider)
|
2014-11-04 17:42:47 +01:00
|
|
|
super
|
2014-06-18 16:58:30 +03:00
|
|
|
end
|
|
|
|
|
|
2013-01-07 09:04:09 +01:00
|
|
|
def update
|
2014-06-26 15:43:24 +03:00
|
|
|
@openids = Openid.where(user_id: current_user.id).order(:provider)
|
2014-11-04 17:42:47 +01:00
|
|
|
super
|
2013-01-07 09:04:09 +01:00
|
|
|
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
|
|
|
|
|
|
2017-11-03 17:41:26 -07:00
|
|
|
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 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 }
|
2014-05-16 20:31:41 +02:00
|
|
|
end
|
|
|
|
|
end
|
2017-11-03 17:41:26 -07:00
|
|
|
|
2014-05-16 20:31:41 +02:00
|
|
|
end
|