mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-10 22:06:46 +08:00
Merge pull request #326 from Ducz0r/lm-sci-746-fix
Fix some recaptcha form submit errors for signup pages
This commit is contained in:
commit
d685ac939b
3 changed files with 18 additions and 1 deletions
|
@ -8,6 +8,10 @@ module Users
|
||||||
|
|
||||||
before_filter :update_sanitized_params, only: :update
|
before_filter :update_sanitized_params, only: :update
|
||||||
|
|
||||||
|
def edit
|
||||||
|
resource.full_name = ''
|
||||||
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
# Instantialize a new organization with the provided name
|
# Instantialize a new organization with the provided name
|
||||||
@org = Organization.new
|
@org = Organization.new
|
||||||
|
@ -158,8 +162,15 @@ module Users
|
||||||
def check_captcha
|
def check_captcha
|
||||||
if Rails.configuration.x.enable_recaptcha
|
if Rails.configuration.x.enable_recaptcha
|
||||||
unless verify_recaptcha
|
unless verify_recaptcha
|
||||||
|
# Construct new resource before rendering :new
|
||||||
self.resource = resource_class.new
|
self.resource = resource_class.new
|
||||||
|
resource.full_name = params[:user][:full_name]
|
||||||
resource.invitation_token = update_resource_params[:invitation_token]
|
resource.invitation_token = update_resource_params[:invitation_token]
|
||||||
|
|
||||||
|
# Also validate organization
|
||||||
|
@org = Organization.new(name: params[:organization][:name])
|
||||||
|
@org.valid?
|
||||||
|
|
||||||
respond_with_navigational(resource) { render :edit }
|
respond_with_navigational(resource) { render :edit }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -253,7 +253,13 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
||||||
def check_captcha
|
def check_captcha
|
||||||
if Rails.configuration.x.enable_recaptcha
|
if Rails.configuration.x.enable_recaptcha
|
||||||
unless verify_recaptcha
|
unless verify_recaptcha
|
||||||
|
# Construct new resource before rendering :new
|
||||||
self.resource = resource_class.new sign_up_params
|
self.resource = resource_class.new sign_up_params
|
||||||
|
|
||||||
|
# Also validate organization
|
||||||
|
@org = Organization.new(name: params[:organization][:name])
|
||||||
|
@org.valid?
|
||||||
|
|
||||||
respond_with_navigational(resource) { render :new }
|
respond_with_navigational(resource) { render :new }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= f.label :full_name %>
|
<%= f.label :full_name %>
|
||||||
<%= f.text_field :full_name, value: '', autofocus: true, class: "form-control" %>
|
<%= f.text_field :full_name, value: resource.full_name, autofocus: true, class: "form-control" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
Loading…
Add table
Reference in a new issue