Commit 324412a1157d4fa0ef27f5076bedc59e571aa3bc

Authored by Victor Navarro
1 parent f8dcf63e

Change logic for external login attribute

Signed-off-by: Vitor Barbosa <vitornga15@gmail.com>
Signed-off-by: Victor Navarro <victor.matias.navarro@gmail.com>
plugins/oauth_client/db/migrate/20160714113820_create_oauth_client_plugin_config.rb
@@ -3,7 +3,7 @@ class CreateOauthClientPluginConfig &lt; ActiveRecord::Migration @@ -3,7 +3,7 @@ class CreateOauthClientPluginConfig &lt; ActiveRecord::Migration
3 def change 3 def change
4 create_table :oauth_client_plugin_configs do |t| 4 create_table :oauth_client_plugin_configs do |t|
5 t.belongs_to :environment 5 t.belongs_to :environment
6 - t.boolean :create_account_for_login, :default => false 6 + t.boolean :allow_external_login, :default => false
7 end 7 end
8 end 8 end
9 end 9 end
plugins/oauth_client/models/oauth_client_plugin/config.rb
1 class OauthClientPlugin::Config < ApplicationRecord 1 class OauthClientPlugin::Config < ApplicationRecord
2 2
3 belongs_to :environment 3 belongs_to :environment
4 - attr_accessible :create_account_for_login, :environment_id 4 + attr_accessible :allow_external_login, :environment_id
5 5
6 class << self 6 class << self
7 def instance 7 def instance
plugins/oauth_client/views/auth/_oauth_login.html.erb
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 <div> 5 <div>
6 <%= render :partial => 'auth/generate_providers_links', :locals => {:providers => providers, :action => ""} %> 6 <%= render :partial => 'auth/generate_providers_links', :locals => {:providers => providers, :action => ""} %>
7 </div> 7 </div>
8 - <% if OauthClientPlugin::Config.instance.create_account_for_login %> 8 + <% if OauthClientPlugin::Config.instance.allow_external_login %>
9 <%= _('Login with:') %> 9 <%= _('Login with:') %>
10 <div> 10 <div>
11 <%= render :partial => 'auth/generate_providers_links', :locals => {:providers => providers, :action => "external_login"} %> 11 <%= render :partial => 'auth/generate_providers_links', :locals => {:providers => providers, :action => "external_login"} %>
plugins/oauth_client/views/oauth_client_plugin_admin/index.html.erb
@@ -3,9 +3,9 @@ @@ -3,9 +3,9 @@
3 <%= labelled_form_for @config, url: { action: "update_configs" } do |f| %> 3 <%= labelled_form_for @config, url: { action: "update_configs" } do |f| %>
4 <table> 4 <table>
5 <tr> 5 <tr>
6 - <%= hidden_field_tag "oauth_client_config[create_account_for_login]", false %>  
7 - <td><%= _('Only allow login with creation of new account') %></td>  
8 - <td><%= check_box_tag "oauth_client_config[create_account_for_login]", true, @config.create_account_for_login %></td> 6 + <%= hidden_field_tag "oauth_client_config[allow_external_login]", false %>
  7 + <td><%= _('Allow external login') %></td>
  8 + <td><%= check_box_tag "oauth_client_config[allow_external_login]", true, @config.allow_external_login %></td>
9 </tr> 9 </tr>
10 </table> 10 </table>
11 11