From d32ac609bf2a5a96189e4071b0b96455b179adb1 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Mon, 11 Nov 2019 16:14:41 +0800 Subject: [PATCH] user manager: apply auth api add show realname column --- app/controllers/users/authentication_applies_controller.rb | 2 +- app/forms/users/apply_authentication_form.rb | 2 +- app/services/users/apply_authentication_service.rb | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/users/authentication_applies_controller.rb b/app/controllers/users/authentication_applies_controller.rb index 183df2f65..3c43be553 100644 --- a/app/controllers/users/authentication_applies_controller.rb +++ b/app/controllers/users/authentication_applies_controller.rb @@ -17,6 +17,6 @@ class Users::AuthenticationAppliesController < Users::BaseAccountController private def create_params - params.permit(:name, :gender, :id_number, :upload_image, attachment_ids: []) + params.permit(:name, :show_realname, :gender, :id_number, :upload_image, attachment_ids: []) end end \ No newline at end of file diff --git a/app/forms/users/apply_authentication_form.rb b/app/forms/users/apply_authentication_form.rb index a9cb60eec..e0e7931b1 100644 --- a/app/forms/users/apply_authentication_form.rb +++ b/app/forms/users/apply_authentication_form.rb @@ -1,7 +1,7 @@ class Users::ApplyAuthenticationForm include ActiveModel::Model - attr_accessor :name, :id_number, :gender, :upload_image, :attachment_ids + attr_accessor :name, :show_realname, :id_number, :gender, :upload_image, :attachment_ids validates :name, presence: true validate :validate_ID_number diff --git a/app/services/users/apply_authentication_service.rb b/app/services/users/apply_authentication_service.rb index cab76b45c..1b9b02c91 100644 --- a/app/services/users/apply_authentication_service.rb +++ b/app/services/users/apply_authentication_service.rb @@ -15,6 +15,7 @@ class Users::ApplyAuthenticationService < ApplicationService user.lastname = params[:name].to_s.strip user.firstname = '' user.ID_number = params[:id_number].to_s.strip.presence + user.show_realname = params[:show_realname].to_s == 'true' if params[:show_realname].to_s.present? ActiveRecord::Base.transaction do user.authentication = false