Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Minor revision of auth_type_id assignation

  • Loading branch information...
commit 37fd0f2cd4e1dc19650348e7fe4437bce3b6a5c9 1 parent 02ed433
Deployment of websites authored
Showing with 14 additions and 2 deletions.
  1. +3 −1 app/models/user.rb
  2. +11 −1 clients/user_profile_client.rb
View
4 app/models/user.rb
@@ -37,7 +37,9 @@ def self.authenticate?(login, password)
if User.exists?(:login => login)
return authenticate_ldap?(login, password)
elsif authenticate_ldap?(login, password)
- User.create(:login => login, :password => 'qw12..', :email => login + '@fisica.unam.mx')
+ auth_type_id = UserProfileClient.login_exists?(login) ? 1 : 3
+ User.create(:login => login, :password => 'qw12..', :email => login + '@fisica.unam.mx',
+ :auth_type_id => auth_type_id, :name => login)
return true
end
return false
View
12 clients/user_profile_client.rb
@@ -26,7 +26,17 @@ def self.find_by_login(login)
end
@object
end
-
+
+ def self.login_exists?(login)
+ @object = new
+ @object.prefix_options = {}
+ begin
+ return true if self.get("show_by_login/#{login}")
+ rescue StandardError => bang
+ return false
+ end
+ end
+
def self.find_by_user_id(id)
self.find(id)
end
Please sign in to comment.
Something went wrong with that request. Please try again.