Signed-off-by: Ohad Levy <ohadlevy@gmail.com>
···
--- app/helpers/auth_source_ldaps_helper.rb | 6 ++++ app/models/auth_source_ldap.rb | 3 +- app/views/auth_source_ldaps/_form.html.erb | 44 ++++++++++++++------------- 3 files changed, 31 insertions(+), 22 deletions(-)diff --git a/app/helpers/auth_source_ldaps_helper.rb b/app/helpers/auth_source_ldaps_helper.rb
index b54724c…287983e 100644
— a/app/helpers/auth_source_ldaps_helper.rb
+++ b/app/helpers/auth_source_ldaps_helper.rb
@@ -1,2 +1,8 @@
module AuthSourceLdapsHelper
+
- def on_the_fly? authsource
- return false if authsource.new_record?
- authsource.onthefly_register?
- end
end
diff --git a/app/models/auth_source_ldap.rb b/app/models/auth_source_ldap.rb
index 26c3b65…5054473 100644
— a/app/models/auth_source_ldap.rb
+++ b/app/models/auth_source_ldap.rb
@@ -19,7 +19,8 @@ require 'net/ldap’
require ‘iconv’
class AuthSourceLdap < AuthSource
- validates_presence_of :host, :port, :attr_login
- validates_presence_of :host, :port
- validates_presence_of :attr_login, :attr_firstname, :attr_lastname, :attr_mail, :if => Proc.new {|auth| auth.onthefly_register? }
validates_length_of :name, :host, :account_password, :maximum => 60, :allow_nil => true
validates_length_of :account, :base_dn, :maximum => 255, :allow_nil => true
validates_length_of :attr_login, :attr_firstname, :attr_lastname, :attr_mail, :maximum => 30, :allow_nil => true
diff --git a/app/views/auth_source_ldaps/_form.html.erb b/app/views/auth_source_ldaps/_form.html.erb
index c9c42ce…837ed76 100644
— a/app/views/auth_source_ldaps/_form.html.erb
+++ b/app/views/auth_source_ldaps/_form.html.erb
@@ -15,8 +15,8 @@
<%= f.label :tls, “LDAPS”, :class => “span-3” %>
- <%= f.label :account, nil, :class => “span-2” %>
- <%= f.text_field :account, :class => “span-3” %>
- <%= f.label :account, nil, :class => “span-2” %>
- <%= f.text_field :account, :class => “span-3” %>
Use this account to authenticate,optional
@@ -25,35 +25,37 @@ Use this account to authenticate, optional
- <%= f.label :base_dn ,nil, :class => "span-2" %> - <%= f.text_field :base_dn, :class => "span-10" %> - <%= f.check_box :onthefly_register, :class => "span-2", :onchange => "$('#on_the_fly_attrs').toggle()" %> - <%= f.label :onthefly_register, "On-the-fly user creation", :class => "span-5 last" %> + <%= f.label :base_dn ,nil, :class => "span-2" %> + <%= f.text_field :base_dn, :class => "span-10" %> + <%= f.check_box :onthefly_register, :class => "span-2", :onchange => "$('#on_the_fly_attrs').toggle()" %> + <%= f.label :onthefly_register, "On-the-fly user creation", :class => "span-5 last" %>
-
>
-
> <% field_set_tag("Attributes for on the fly user creation") do %>+ +
-
<%= f.label :attr_login, nil, :class => "span-3" %>
-
<%= f.text_field :attr_login, :class => "span-4" %>
-
<small class="last" >e.g. uid</small>
-
<%= f.label :attr_login, nil, :class => "span-3" %>
-
<%= f.text_field :attr_login, :class => "span-4" %>
-
<small class="last" >e.g. uid</small> </p> <p class="span-24">
-
<%= f.label :attr_firstname, nil, :class => "span-3" %>
-
<%= f.text_field :attr_firstname, :class => "span-4" %>
-
<small class="last">e.g. givenName</small>
-
<%= f.label :attr_firstname, nil, :class => "span-3" %>
-
<%= f.text_field :attr_firstname, :class => "span-4" %>
-
<small class="last">e.g. givenName</small> </p> <p class="span-24">
-
<%= f.label :attr_lastname, nil, :class => "span-3" %>
-
<%= f.text_field :attr_lastname, :class => "span-4" %>
-
<small class="last">e.g. sn</small>
-
<%= f.label :attr_lastname, nil, :class => "span-3" %>
-
<%= f.text_field :attr_lastname, :class => "span-4" %>
-
<small class="last">e.g. sn</small> </p>
-
<p class="span-24">
-
<%= f.label :attr_mail, nil, :class => "span-3" %>
-
<%= f.text_field :attr_mail, :class => "span-4" %>
-
<small class="last">e.g. mail</small>
-
<p class="span-24 last">
-
<%= f.label :attr_mail, nil, :class => "span-3" %>
-
<%= f.text_field :attr_mail, :class => "span-4" %>
-
<% end -%><small class="last">e.g. mail</small> </p>
- <%= f.submit “Submit” %>
+ <%= f.submit "Submit" %> <% end %> -- 1.7.6.2 -
-