self.logged_user = nil
else
# Authenticate user
- unless using_open_id?
- password_authentication
- else
+ if using_open_id? && Setting.openid?
open_id_authenticate(params[:openid_url])
+ else
+ password_authentication
end
end
end
<td align="right"><label for="password"><%=l(:field_password)%>:</label></td>
<td align="left"><%= password_field_tag 'password', nil, :size => 40 %></td>
</tr>
+<% if Setting.openid? %>
<tr>
<td align="right"><label for="openid_url"><%=l(:field_identity_url)%></label></td>
<td align="left"><%= text_field_tag "openid_url" %></td>
</tr>
+<% end %>
<tr>
<td></td>
<td align="left">
-<h2><%=l(:label_register)%> <%=link_to l(:label_login_with_open_id_option), signin_url %></h2>
+<h2><%=l(:label_register)%><%=link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %></h2>
<% form_tag({:action => 'register'}, :class => "tabular") do %>
<%= error_messages_for 'user' %>
<p><label for="user_language"><%=l(:field_language)%></label>
<%= select("user", "language", lang_options_for_select) %></p>
+<% if Setting.openid? %>
<p><label for="user_identity_url"><%=l(:field_identity_url)%></label>
<%= text_field 'user', 'identity_url' %></p>
+<% end %>
<% @user.custom_field_values.select {|v| v.editable? || v.required?}.each do |value| %>
<p><%= custom_field_tag_with_label :user, value %></p>
<p><label><%= l(:label_password_lost) %></label>
<%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %></p>
+
+<p><label><%= l(:setting_openid) %></label>
+<%= check_box_tag 'settings[openid]', 1, Setting.openid? %><%= hidden_field_tag 'settings[openid]', 0 %></p>
</div>
<div style="float:right;">
<p><%= f.text_field :lastname, :required => true %></p>
<p><%= f.text_field :mail, :required => true %></p>
<p><%= f.select :language, lang_options_for_select %></p>
+<% if Setting.openid? %>
<p><%= f.text_field :identity_url %></p>
+<% end %>
<% @user.custom_field_values.each do |value| %>
<p><%= custom_field_tag_with_label :user, value %></p>
To change your notification preferences, please click here: http://hostname/my/account
gravatar_enabled:
default: 0
+openid:
+ default: 0
setting_gravatar_enabled: Use Gravatar user icons
setting_diff_max_lines_displayed: Max number of diff lines displayed
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
+setting_openid: Allow OpenID login and registration
permission_edit_project: Edit project
permission_select_project_modules: Select project modules
def test_login_with_openid_for_existing_user
Setting.self_registration = '3'
+ Setting.openid = '1'
existing_user = User.new(:firstname => 'Cool',
:lastname => 'User',
:mail => 'user@somedomain.com',
def test_login_with_openid_with_new_user_created
Setting.self_registration = '3'
+ Setting.openid = '1'
post :login, :openid_url => 'http://openid.example.com/good_user'
assert_redirected_to 'my/account'
user = User.find_by_login('cool_user')
def test_login_with_openid_with_new_user_and_self_registration_off
Setting.self_registration = '0'
+ Setting.openid = '1'
post :login, :openid_url => 'http://openid.example.com/good_user'
assert_redirected_to home_url
user = User.find_by_login('cool_user')
def test_login_with_openid_with_new_user_created_with_email_activation_should_have_a_token
Setting.self_registration = '1'
+ Setting.openid = '1'
post :login, :openid_url => 'http://openid.example.com/good_user'
assert_redirected_to 'login'
user = User.find_by_login('cool_user')
def test_login_with_openid_with_new_user_created_with_manual_activation
Setting.self_registration = '2'
+ Setting.openid = '1'
post :login, :openid_url => 'http://openid.example.com/good_user'
assert_redirected_to 'login'
user = User.find_by_login('cool_user')
def test_login_with_openid_with_new_user_with_conflict_should_register
Setting.self_registration = '3'
+ Setting.openid = '1'
existing_user = User.new(:firstname => 'Cool', :lastname => 'User', :mail => 'user@somedomain.com')
existing_user.login = 'cool_user'
assert existing_user.save!