Commit 8bdf09b3 authored by Ryan Lee's avatar Ryan Lee

more specific http codes, tests

parent 94ecd452
...@@ -2,15 +2,15 @@ class ZepheiraController < ApplicationController ...@@ -2,15 +2,15 @@ class ZepheiraController < ApplicationController
def ldap def ldap
if request.post? if request.post?
login = params[:username]
user = nil user = nil
login = params[:username]
auth_sources = AuthSource.find(:all) auth_sources = AuthSource.find(:all)
auth_sources.each do |src| auth_sources.each do |src|
if src.auth_method_name == 'LDAP' if src.auth_method_name == 'LDAP'
user_dn = src.get_user_dn(login) user_dn = src.get_user_dn(login)
if user_dn if user_dn.length > 0
attrs = src.get_user_attributes_from_ldap_entry(user_dn) attrs = src.get_user_attributes_from_ldap_entry(user_dn)
user = User.new(attrs.except(:dn).except(:login)) user = User.new(attrs.except([:dn, :login]))
user.login = login user.login = login
user.language = Setting.default_language user.language = Setting.default_language
if user.save if user.save
...@@ -22,10 +22,10 @@ class ZepheiraController < ApplicationController ...@@ -22,10 +22,10 @@ class ZepheiraController < ApplicationController
if user.nil? if user.nil?
render_404 render_404
else else
render :nothing => true, :status => 200 render :nothing => true, :status => 201
end end
else else
render_404 render_405
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment