2016-09-24 11:00:46 +08:00
|
|
|
# frozen_string_literal: true
|
2014-10-07 17:46:09 -04:00
|
|
|
class Users::RegistrationsController < Devise::RegistrationsController
|
2016-02-28 17:48:18 +08:00
|
|
|
before_action :configure_sign_up_params, only: [:create]
|
|
|
|
before_action :configure_account_update_params, only: [:update]
|
2016-10-16 20:22:00 -04:00
|
|
|
after_action :store_location, only: [:new]
|
2015-11-03 20:56:50 +08:00
|
|
|
|
2014-10-07 17:46:09 -04:00
|
|
|
protected
|
|
|
|
|
2016-07-26 08:14:23 +08:00
|
|
|
def after_update_path_for(resource)
|
|
|
|
signed_in_root_path(resource)
|
|
|
|
end
|
2015-11-03 20:56:50 +08:00
|
|
|
|
|
|
|
private
|
|
|
|
|
2016-10-16 20:22:00 -04:00
|
|
|
def store_location
|
|
|
|
if params[:redirect_to]
|
|
|
|
store_location_for(User, params[:redirect_to])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-07-26 08:14:23 +08:00
|
|
|
def configure_sign_up_params
|
2016-09-22 01:22:40 +08:00
|
|
|
devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :joinedwithcode])
|
2016-07-26 08:14:23 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def configure_account_update_params
|
2016-09-22 01:22:40 +08:00
|
|
|
devise_parameter_sanitizer.permit(:account_update, keys: [:image])
|
2016-07-26 08:14:23 +08:00
|
|
|
end
|
2014-10-07 17:46:09 -04:00
|
|
|
end
|