allow adding users and set new users has having cas as the auth type

This commit is contained in:
Erik Ordway 2009-11-23 22:23:37 -08:00 committed by Eric Allen
parent 1621a7bb7d
commit b85b3fc081
3 changed files with 20 additions and 1 deletions

View file

@ -74,6 +74,11 @@ class UsersController < ApplicationController
first_user_signing_up = User.no_users_yet?
user.is_admin = true if first_user_signing_up
if Tracks::Config.auth_schemes.include?('cas')
user.auth_type = "cas" #since CAS will be doing all the auth we may as well set it for everyone when CAS in enabled
end
if user.save
@user = User.authenticate(user.login, params['user']['password'])
@user.create_preference

View file

@ -153,6 +153,9 @@ class User < ActiveRecord::Base
if Tracks::Config.auth_schemes.include?('ldap')
return candidate if candidate.auth_type == 'ldap' && SimpleLdapAuthenticator.valid?(login, pass)
end
if Tracks::Config.auth_schemes.include?('cas')
return candidate #because we can not auth them with out thier real password we have to settle for this
end
return nil
end

View file

@ -12,7 +12,17 @@
<td><label for="user_login">Desired login:</label></td>
<td> <%= text_field "user", "login", :size => 20 %></td>
</tr>
<tr>
<%if Tracks::Config.auth_schemes.include?('cas')%>
<tr style="display:none">
<td><label for="user_password">Choose password:</label></td>
<td><%= password_field "user", "password", :size => 20 , :value => "fakebecauseweusecas" %></td>
</tr>
<tr style="display:none">
<td><label for="user_password_confirmation">Confirm password:</label></td>
<td><%= password_field "user", "password_confirmation", :size => 20, :value => "fakebecauseweusecas" %></td>
</tr>
<%else%>
<tr>
<td><label for="user_password">Choose password:</label></td>
<td><%= password_field "user", "password", :size => 20 %></td>
</tr>
@ -20,6 +30,7 @@
<td><label for="user_password_confirmation">Confirm password:</label></td>
<td><%= password_field "user", "password_confirmation", :size => 20 %></td>
</tr>
<%end%>
<tr>
<td></td>
<td><input type="submit" id="signup" value="Signup &#187;" class="primary" /></td>