Feature #11357 » redmine-openid_dropdown-DrewDahl-11357-2.patch
app/models/open_id_provider.rb | ||
---|---|---|
1 |
# Redmine - project management software |
|
2 |
# Copyright (C) 2006-2012 Jean-Philippe Lang |
|
3 |
# |
|
4 |
# This program is free software; you can redistribute it and/or |
|
5 |
# modify it under the terms of the GNU General Public License |
|
6 |
# as published by the Free Software Foundation; either version 2 |
|
7 |
# of the License, or (at your option) any later version. |
|
8 |
# |
|
9 |
# This program is distributed in the hope that it will be useful, |
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
# GNU General Public License for more details. |
|
13 |
# |
|
14 |
# You should have received a copy of the GNU General Public License |
|
15 |
# along with this program; if not, write to the Free Software |
|
16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | ||
18 |
class OpenIdProvider < ActiveRecord::Base |
|
19 |
self.table_name = "#{table_name_prefix}open_id_providers#{table_name_suffix}" |
|
20 | ||
21 |
validates_presence_of :name, :url |
|
22 |
end |
app/views/account/login.html.erb | ||
---|---|---|
14 | 14 |
<% if Setting.openid? %> |
15 | 15 |
<tr> |
16 | 16 |
<td align="right"><label for="openid_url"><%=l(:field_identity_url)%></label></td> |
17 |
<td align="left"><%= text_field_tag "openid_url", nil, :tabindex => '3' %></td> |
|
17 |
<td align="left"> |
|
18 |
<%= text_field_tag 'openid_url', nil, :tabindex => '3' %> |
|
19 |
<%= select_tag :openid_url_select, options_for_select(OpenIdProvider.all.collect {|p| [p.name, p.url]}), { :tabindex => '4', :prompt => l(:field_identity_url) } %> |
|
20 |
</td> |
|
18 | 21 |
</tr> |
19 | 22 |
<% end %> |
20 | 23 |
<tr> |
... | ... | |
37 | 40 |
</tr> |
38 | 41 |
</table> |
39 | 42 |
<%= javascript_tag "$('#username').focus();" %> |
43 |
<% if Setting.openid? %> |
|
44 |
<%= javascript_tag "$('#openid_url_select').change(function() { $('#openid_url').val ($('#openid_url_select').val());});" %> |
|
45 |
<% end %> |
|
40 | 46 |
<% end %> |
41 | 47 |
</div> |
42 | 48 |
<%= call_hook :view_account_login_bottom %> |
public/stylesheets/application.css | ||
---|---|---|
96 | 96 |
div.modal h3.title {display:none;} |
97 | 97 |
div.modal p.buttons {text-align:right; margin-bottom:0;} |
98 | 98 | |
99 |
input#openid_url { background: url(../images/openid-bg.gif) no-repeat; background-color: #fff; background-position: 0 50%; padding-left: 18px; } |
|
99 |
input#openid_url { background: url(../images/openid-bg.gif) no-repeat; background-color: #fff; background-position: 0 50%; padding-left: 18px; width: 177px;} |
|
100 |
select#openid_url_select { width: 100px; } |
|
100 | 101 | |
101 | 102 |
.clear:after{ content: "."; display: block; height: 0; clear: both; visibility: hidden; } |
102 | 103 | |
103 |
- |
db/migrate/20121216105941_add_open_id_providers_table.rb | ||
---|---|---|
1 |
class AddOpenIdProvidersTable < ActiveRecord::Migration |
|
2 |
def self.up |
|
3 |
create_table :open_id_providers, :force => true do |t| |
|
4 |
t.string :url, :null => false |
|
5 |
t.string :name, :limit => 30, :null => false |
|
6 |
end |
|
7 | ||
8 |
end |
|
9 | ||
10 |
def self.down |
|
11 |
drop_table :open_id_providers |
|
12 |
end |
|
13 |
end |
db/migrate/20121216110401_insert_open_id_providers.rb | ||
---|---|---|
1 |
class InsertOpenIdProviders < ActiveRecord::Migration |
|
2 |
def self.up |
|
3 |
OpenIdProvider.reset_column_information |
|
4 |
google = OpenIdProvider.new(:name => 'Google', :url => 'https://www.google.com/accounts/o8/id') |
|
5 |
google.save |
|
6 | ||
7 |
yahoo = OpenIdProvider.new(:name => 'Yahoo', :url => 'http://me.yahoo.com/') |
|
8 |
yahoo.save |
|
9 | ||
10 |
aol = OpenIdProvider.new(:name => 'AOL', :url => 'http://openid.aol.com/{username}') |
|
11 |
aol.save |
|
12 | ||
13 |
myopenid = OpenIdProvider.new(:name => 'MyOpenID', :url => 'http://{username}.myopenid.com/') |
|
14 |
myopenid.save |
|
15 | ||
16 |
livejournal = OpenIdProvider.new(:name => 'LiveJournal', :url => 'http://{username}.livejournal.com/') |
|
17 |
livejournal.save |
|
18 | ||
19 |
wordpress = OpenIdProvider.new(:name => 'Wordpress', :url => 'http://{username}.wordpress.com/') |
|
20 |
wordpress.save |
|
21 | ||
22 |
blogger = OpenIdProvider.new(:name => 'Blogger', :url => 'http://{username}.blogspot.com/') |
|
23 |
blogger.save |
|
24 | ||
25 |
verisign = OpenIdProvider.new(:name => 'Verisign', :url => 'http://{username}.pip.verisignlabs.com/') |
|
26 |
verisign.save |
|
27 | ||
28 |
claimid = OpenIdProvider.new(:name => 'ClaimID', :url => 'http://claimid.com/{username}') |
|
29 |
claimid.save |
|
30 | ||
31 |
clickpass = OpenIdProvider.new(:name => 'ClickPass', :url => 'http://clickpass.com/public/{username}') |
|
32 |
clickpass.save |
|
33 | ||
34 |
googleprofile = OpenIdProvider.new(:name => 'Google Profile', :url => 'http://www.google.com/profiles/{username}') |
|
35 |
googleprofile.save |
|
36 |
end |
|
37 | ||
38 |
def self.down |
|
39 |
OpenIdProvider.destroy_all |
|
40 |
end |
|
41 |
end |
- « Previous
- 1
- …
- 3
- 4
- 5
- Next »