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

more specific http codes, tests

parent 94ecd452
......@@ -2,15 +2,15 @@ class ZepheiraController < ApplicationController
def ldap
if request.post?
login = params[:username]
user = nil
login = params[:username]
auth_sources = AuthSource.find(:all)
auth_sources.each do |src|
if src.auth_method_name == 'LDAP'
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)
user = User.new(attrs.except(:dn).except(:login))
user = User.new(attrs.except([:dn, :login]))
user.login = login
user.language = Setting.default_language
if user.save
......@@ -22,10 +22,10 @@ class ZepheiraController < ApplicationController
if user.nil?
render_404
else
render :nothing => true, :status => 200
render :nothing => true, :status => 201
end
else
render_404
render_405
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