##// END OF EJS Templates
Added a system setting for allowing OpenID logins and registrations...
Eric Davis -
r2388:8d53e433c55b
parent child
Show More
@@ -46,10 +46,10 class AccountController < ApplicationController
46 46 self.logged_user = nil
47 47 else
48 48 # Authenticate user
49 unless using_open_id?
50 password_authentication
51 else
49 if using_open_id? && Setting.openid?
52 50 open_id_authenticate(params[:openid_url])
51 else
52 password_authentication
53 53 end
54 54 end
55 55 end
@@ -10,10 +10,12
10 10 <td align="right"><label for="password"><%=l(:field_password)%>:</label></td>
11 11 <td align="left"><%= password_field_tag 'password', nil, :size => 40 %></td>
12 12 </tr>
13 <% if Setting.openid? %>
13 14 <tr>
14 15 <td align="right"><label for="openid_url"><%=l(:field_identity_url)%></label></td>
15 16 <td align="left"><%= text_field_tag "openid_url" %></td>
16 17 </tr>
18 <% end %>
17 19 <tr>
18 20 <td></td>
19 21 <td align="left">
@@ -1,4 +1,4
1 <h2><%=l(:label_register)%> <%=link_to l(:label_login_with_open_id_option), signin_url %></h2>
1 <h2><%=l(:label_register)%><%=link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %></h2>
2 2
3 3 <% form_tag({:action => 'register'}, :class => "tabular") do %>
4 4 <%= error_messages_for 'user' %>
@@ -29,8 +29,10
29 29 <p><label for="user_language"><%=l(:field_language)%></label>
30 30 <%= select("user", "language", lang_options_for_select) %></p>
31 31
32 <% if Setting.openid? %>
32 33 <p><label for="user_identity_url"><%=l(:field_identity_url)%></label>
33 34 <%= text_field 'user', 'identity_url' %></p>
35 <% end %>
34 36
35 37 <% @user.custom_field_values.select {|v| v.editable? || v.required?}.each do |value| %>
36 38 <p><%= custom_field_tag_with_label :user, value %></p>
@@ -17,6 +17,9
17 17
18 18 <p><label><%= l(:label_password_lost) %></label>
19 19 <%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %></p>
20
21 <p><label><%= l(:setting_openid) %></label>
22 <%= check_box_tag 'settings[openid]', 1, Setting.openid? %><%= hidden_field_tag 'settings[openid]', 0 %></p>
20 23 </div>
21 24
22 25 <div style="float:right;">
@@ -7,7 +7,9
7 7 <p><%= f.text_field :lastname, :required => true %></p>
8 8 <p><%= f.text_field :mail, :required => true %></p>
9 9 <p><%= f.select :language, lang_options_for_select %></p>
10 <% if Setting.openid? %>
10 11 <p><%= f.text_field :identity_url %></p>
12 <% end %>
11 13
12 14 <% @user.custom_field_values.each do |value| %>
13 15 <p><%= custom_field_tag_with_label :user, value %></p>
@@ -143,3 +143,5 emails_footer:
143 143 To change your notification preferences, please click here: http://hostname/my/account
144 144 gravatar_enabled:
145 145 default: 0
146 openid:
147 default: 0
@@ -229,6 +229,7 setting_sequential_project_identifiers: Generate sequential project identifiers
229 229 setting_gravatar_enabled: Use Gravatar user icons
230 230 setting_diff_max_lines_displayed: Max number of diff lines displayed
231 231 setting_repository_log_display_limit: Maximum number of revisions displayed on file log
232 setting_openid: Allow OpenID login and registration
232 233
233 234 permission_edit_project: Edit project
234 235 permission_select_project_modules: Select project modules
@@ -66,6 +66,7 class AccountControllerTest < Test::Unit::TestCase
66 66
67 67 def test_login_with_openid_for_existing_user
68 68 Setting.self_registration = '3'
69 Setting.openid = '1'
69 70 existing_user = User.new(:firstname => 'Cool',
70 71 :lastname => 'User',
71 72 :mail => 'user@somedomain.com',
@@ -79,6 +80,7 class AccountControllerTest < Test::Unit::TestCase
79 80
80 81 def test_login_with_openid_with_new_user_created
81 82 Setting.self_registration = '3'
83 Setting.openid = '1'
82 84 post :login, :openid_url => 'http://openid.example.com/good_user'
83 85 assert_redirected_to 'my/account'
84 86 user = User.find_by_login('cool_user')
@@ -89,6 +91,7 class AccountControllerTest < Test::Unit::TestCase
89 91
90 92 def test_login_with_openid_with_new_user_and_self_registration_off
91 93 Setting.self_registration = '0'
94 Setting.openid = '1'
92 95 post :login, :openid_url => 'http://openid.example.com/good_user'
93 96 assert_redirected_to home_url
94 97 user = User.find_by_login('cool_user')
@@ -97,6 +100,7 class AccountControllerTest < Test::Unit::TestCase
97 100
98 101 def test_login_with_openid_with_new_user_created_with_email_activation_should_have_a_token
99 102 Setting.self_registration = '1'
103 Setting.openid = '1'
100 104 post :login, :openid_url => 'http://openid.example.com/good_user'
101 105 assert_redirected_to 'login'
102 106 user = User.find_by_login('cool_user')
@@ -108,6 +112,7 class AccountControllerTest < Test::Unit::TestCase
108 112
109 113 def test_login_with_openid_with_new_user_created_with_manual_activation
110 114 Setting.self_registration = '2'
115 Setting.openid = '1'
111 116 post :login, :openid_url => 'http://openid.example.com/good_user'
112 117 assert_redirected_to 'login'
113 118 user = User.find_by_login('cool_user')
@@ -117,6 +122,7 class AccountControllerTest < Test::Unit::TestCase
117 122
118 123 def test_login_with_openid_with_new_user_with_conflict_should_register
119 124 Setting.self_registration = '3'
125 Setting.openid = '1'
120 126 existing_user = User.new(:firstname => 'Cool', :lastname => 'User', :mail => 'user@somedomain.com')
121 127 existing_user.login = 'cool_user'
122 128 assert existing_user.save!
General Comments 0
You need to be logged in to leave comments. Login now