[Git][noosfero/noosfero][master-1.x] 2 commits: Fixes OauthClient plugin, adds signup message
Rodrigo Souto
gitlab at mg.gitlab.com
Wed May 16 15:53:16 BRT 2018
Rodrigo Souto pushed to branch master-1.x at Noosfero / noosfero
Commits:
ba7ca2fc by Gabriel Silva at 2018-05-15T20:03:52Z
Fixes OauthClient plugin, adds signup message
Signed-off-by: Gabriel Silva <gabriel93.silva at gmail.com>
- - - - -
976436fa by Rodrigo Souto at 2018-05-16T18:52:47Z
Merge branch 'oauth-client-signup' into 'master-1.x'
[OauthPlugin] User fixes, improvements on signup page
See merge request noosfero/noosfero!1493
- - - - -
6 changed files:
- plugins/oauth_client/lib/ext/user.rb
- plugins/oauth_client/lib/oauth_client_plugin.rb
- plugins/oauth_client/public/style.css → plugins/oauth_client/public/style.scss
- plugins/oauth_client/test/functional/oauth_client_plugin_account_controller_test.rb
- plugins/oauth_client/views/account/_oauth_signup.html.erb
- + plugins/oauth_client/views/account/signup.html.erb
Changes:
=====================================
plugins/oauth_client/lib/ext/user.rb
=====================================
--- a/plugins/oauth_client/lib/ext/user.rb
+++ b/plugins/oauth_client/lib/ext/user.rb
@@ -31,10 +31,10 @@ class User
alias_method_chain :password_required?, :oauth
- def make_activation_code_with_oauth
- @oauth_providers.blank? && oauth_providers.blank? ? make_activation_code_without_oauth : nil
+ def make_activation_codes_with_oauth
+ @oauth_providers.blank? && oauth_providers.blank? ? make_activation_codes_without_oauth : nil
end
- alias_method_chain :make_activation_code, :oauth
+ alias_method_chain :make_activation_codes, :oauth
end
=====================================
plugins/oauth_client/lib/oauth_client_plugin.rb
=====================================
--- a/plugins/oauth_client/lib/oauth_client_plugin.rb
+++ b/plugins/oauth_client/lib/oauth_client_plugin.rb
@@ -90,8 +90,9 @@ class OauthClientPlugin < Noosfero::Plugin
def account_controller_filters
{
- :type => 'before_filter', :method_name => 'signup',
- :block => proc {
+ type: 'before_filter', method_name: 'check_email_on_oauth_signup',
+ options: { only: :signup },
+ block: proc {
auth = session[:oauth_data]
if auth.present? && params[:user].present?
@@ -105,7 +106,6 @@ class OauthClientPlugin < Noosfero::Plugin
end
def js_files
- ["script.js"]
+ ["script.js"]
end
-
end
=====================================
plugins/oauth_client/public/style.css → plugins/oauth_client/public/style.scss
=====================================
--- a/plugins/oauth_client/public/style.css
+++ b/plugins/oauth_client/public/style.scss
@@ -1,22 +1,38 @@
-.oauth-login .provider a {
- min-width: 20px;
- min-height: 20px;
- background-size: 20px;
- display: inline-block;
- text-decoration: none;
- background-repeat: no-repeat;
- line-height: 20px;
-}
-.oauth-login .provider a img {
- max-width: 40px;
-}
-.oauth-login .provider a:hover {
- opacity: 0.7;
-}
-.oauth-login .provider .developer {
- display: none;
+.oauth-login .provider {
+ a {
+ min-width: 20px;
+ min-height: 20px;
+ background-size: 20px;
+ display: inline-block;
+ text-decoration: none;
+ background-repeat: no-repeat;
+ line-height: 20px;
+
+ img {
+ max-width: 40px;
+ }
+
+ &:hover {
+ opacity: 0.7;
+ }
+ }
+
+ .developer {
+ display: none;
+ }
}
.remember-enable-email.hidden {
display: none;
}
+
+#oauth-signup {
+ #signup-password-section {
+ display: none;
+ }
+
+ #signup-email input {
+ pointer-events: none;
+ opacity: 0.5;
+ }
+}
=====================================
plugins/oauth_client/test/functional/oauth_client_plugin_account_controller_test.rb
=====================================
--- a/plugins/oauth_client/test/functional/oauth_client_plugin_account_controller_test.rb
+++ b/plugins/oauth_client/test/functional/oauth_client_plugin_account_controller_test.rb
@@ -1,9 +1,19 @@
require 'test_helper'
class AccountControllerTest < ActionController::TestCase
+ def setup
+ Environment.default.enable_plugin OauthClientPlugin
+ end
- should 'render signup page' do
+ should 'not render custom div if session does not contain auuth' do
+ session[:oauth_data] = nil
get :signup
+ assert_no_tag :div, attributes: { id: 'oauth-signup' }
end
+ should 'render custom div if session contains auuth' do
+ session[:oauth_data] = { something: 'something' }
+ get :signup
+ assert_tag :div, attributes: { id: 'oauth-signup' }
+ end
end
=====================================
plugins/oauth_client/views/account/_oauth_signup.html.erb
=====================================
--- a/plugins/oauth_client/views/account/_oauth_signup.html.erb
+++ b/plugins/oauth_client/views/account/_oauth_signup.html.erb
@@ -1,11 +1 @@
<%= hidden_field_tag 'return_to', '/' %>
-
-<style>
- #signup-password, #signup-password-confirmation, #signup-email {
- display: none;
- }
-</style>
-
-<div id='signup-email-readonly'>
- <%= labelled_form_field(_('Email'), text_field(:user, :email, :class => "disabled", :readonly => true)) %>
-</div>
=====================================
plugins/oauth_client/views/account/signup.html.erb
=====================================
--- /dev/null
+++ b/plugins/oauth_client/views/account/signup.html.erb
@@ -0,0 +1,19 @@
+<% if session[:oauth_data].present? %>
+ <h1><%= _('Finish your registration.') % environment.name %></h1>
+ <p><%= _('It is the first time you sign in, so we need some information '\
+ 'to create your profile.') %></p>
+
+ <div id='oauth-signup'>
+ <div id='signup-intro'>
+ <%= environment.signup_intro.try(:html_safe) %>
+ </div>
+ <%= render :partial => 'signup_form' %>
+ </div>
+<% else %>
+ <h1><%= _('Sign up for %s!') % environment.name %></h1>
+
+ <div id='signup-intro'>
+ <%= environment.signup_intro.try(:html_safe) %>
+ </div>
+ <%= render :partial => 'signup_form' %>
+<% end %>
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/8c6d962cdd0c9cdb16e298d12162c2e58acb9ef4...976436fa95c26c454855c66a9a64f3e36fda72ba
--
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/8c6d962cdd0c9cdb16e298d12162c2e58acb9ef4...976436fa95c26c454855c66a9a64f3e36fda72ba
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20180516/5bd425d6/attachment-0001.html>
More information about the Noosfero-dev
mailing list