Add support for Google OAuth2 authentication

This replaces OpenID authentication, which is going away soon, but
provides an upgrade path where we can migrate users that already have
a Google OpenID setup to the new system transparently.
This commit is contained in:
Tom Hughes 2015-02-28 15:56:41 +00:00
parent 7ed50894e2
commit eeb9866d50
10 changed files with 51 additions and 12 deletions

View file

@ -48,7 +48,7 @@
<fieldset>
<div class="form-row">
<label class="standard-label"><%= t 'user.account.external auth' %></label>
<%= f.select :auth_provider, { "None" => "", "OpenID" => "openid" } %>
<%= f.select :auth_provider, Auth::PROVIDERS %>
<%= f.text_field :auth_uid %>
<span class="form-help deemphasize">(<a href="<%= t 'user.account.openid.link' %>" target="_new"><%= t 'user.account.openid.link text' %></a>)</span>
</diV>

View file

@ -42,7 +42,9 @@
<ul class='clearfix' id="login_auth_buttons">
<li><%= link_to image_tag("openid.png", :alt => t("user.login.auth_providers.openid.title")), "#", :id => "openid_open_url", :title => t("user.login.auth_providers.openid.title") %></li>
<li><%= auth_button "google", "openid", :openid_url => "https://www.google.com/accounts/o8/id" %></li>
<% if defined?(GOOGLE_AUTH_ID) -%>
<li><%= auth_button "google", "google" %></li>
<% end -%>
<li><%= auth_button "yahoo", "openid", :openid_url => "yahoo.com" %></li>
<li><%= auth_button "wordpress", "openid", :openid_url => "wordpress.com" %></li>
<li><%= auth_button "aol", "openid", :openid_url => "aol.com" %></li>

View file

@ -45,7 +45,7 @@
<label for="openid_url" class="standard-label">
<%= raw t 'user.new.external auth' %>
</label>
<%= select(:user, :auth_provider, { "None" => "", "OpenID" => "openid" }, { :default => "", :tabindex => 4 }) %>
<%= select(:user, :auth_provider, Auth::PROVIDERS, { :default => "", :tabindex => 4 }) %>
<%= text_field(:user, :auth_uid, { :tabindex => 5 }) %>
<%= error_message_on(:user, :auth_uid) %>
</div>