Merge pull request #332 from Ducz0r/lm-sci-750-751

Fix inviting users not working
This commit is contained in:
Luka Murn 2016-12-01 15:52:40 +01:00 committed by GitHub
commit 372b455d7d
3 changed files with 6 additions and 13 deletions

View file

@ -8,10 +8,6 @@ module Users
before_filter :update_sanitized_params, only: :update
def edit
resource.full_name = ''
end
def update
# Instantialize a new organization with the provided name
@org = Organization.new
@ -162,15 +158,8 @@ module Users
def check_captcha
if Rails.configuration.x.enable_recaptcha
unless verify_recaptcha
# Construct new resource before rendering :new
self.resource = resource_class.new
resource.full_name = params[:user][:full_name]
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 }
end
end

View file

@ -160,7 +160,11 @@ class User < ActiveRecord::Base
# Whether user is active (= confirmed) or not
def active?
confirmed_at.present?
if confirmation_required?
confirmed_at.present?
else
invited_by.present? ? invitation_accepted? : true
end
end
def active_status_str

View file

@ -10,7 +10,7 @@
<div class="form-group">
<%= f.label :full_name %>
<%= f.text_field :full_name, value: resource.full_name, autofocus: true, class: "form-control" %>
<%= f.text_field :full_name, value: '', autofocus: true, class: "form-control" %>
</div>
<div class="form-group">