From 248bff712cb072e4988911c0800df12e431d39d5 Mon Sep 17 00:00:00 2001 From: kikito Date: Fri, 22 Jan 2016 10:56:30 +0100 Subject: [PATCH] fixes failing i18n specs Eliminates registering_with_oauth attr_accessor ELIMINATE Conflicts: app/views/users/registrations/finish_signup.html.erb improves devise confirmation message improves devise omniauth confirmation message improves devise omniauth confirmation message do not use nils on finish_signup fields Fixes auth specs after changing the i18n --- app/models/user.rb | 1 - .../registrations/finish_signup.html.erb | 36 ++++++++----------- config/locales/devise.en.yml | 2 +- config/locales/devise.es.yml | 8 ++--- config/locales/en.yml | 7 ++-- config/locales/es.yml | 7 ++-- spec/features/users_auth_spec.rb | 4 ++- 7 files changed, 29 insertions(+), 36 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index bc8faa8a9..5fe0e77ea 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -39,7 +39,6 @@ class User < ActiveRecord::Base accepts_nested_attributes_for :organization, update_only: true attr_accessor :skip_password_validation - attr_accessor :registering_with_oauth scope :administrators, -> { joins(:administrators) } scope :moderators, -> { joins(:moderator) } diff --git a/app/views/users/registrations/finish_signup.html.erb b/app/views/users/registrations/finish_signup.html.erb index 95e8a8098..5542ed6c3 100644 --- a/app/views/users/registrations/finish_signup.html.erb +++ b/app/views/users/registrations/finish_signup.html.erb @@ -1,25 +1,19 @@ -
-
-
-

<%= t('omniauth.finish_signup.title') %>

+

<%= t('omniauth.finish_signup.title') %>

- <%= form_for current_user, as: :user, url: do_finish_signup_path, html: { role: 'form'} do |f| %> - <%= render 'shared/errors', resource: current_user %> +<%= form_for current_user, as: :user, url: do_finish_signup_path, html: { role: 'form'} do |f| %> + <%= render 'shared/errors', resource: current_user %> - <% if current_user.errors.include? :username %> - <%= f.text_field :username, placeholder: t("devise_views.users.registrations.new.username_label"), value: nil %> - <% else %> - <%= f.hidden_field :username %> - <% end %> + <% if current_user.errors.include? :username %> + <%= f.text_field :username, placeholder: t("devise_views.users.registrations.new.username_label") %> + <% else %> + <%= f.hidden_field :username %> + <% end %> - <% if current_user.errors.include? :email %> - <%= f.email_field :email, placeholder: t("devise_views.users.registrations.new.email_label"), value: nil %> - <% else %> - <%= f.hidden_field :email %> - <% end %> + <% if current_user.errors.include? :email %> + <%= f.email_field :email, placeholder: t("devise_views.users.registrations.new.email_label") %> + <% else %> + <%= f.hidden_field :email %> + <% end %> - <%= f.submit t("devise_views.users.registrations.new.submit"), class: 'button radius expand' %> - <% end %> -
-
-
+ <%= f.submit t("devise_views.users.registrations.new.submit"), class: 'button radius expand' %> +<% end %> diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index 473181f02..a7504ff3d 100755 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -15,7 +15,7 @@ en: not_found_in_database: "Invalid %{authentication_keys} or password." timeout: "Your session has expired. Please sign in again to continue." unauthenticated: "You must sign in or register to continue." - unconfirmed: "You must confirm your account to continue." + unconfirmed: "To continue, please click on the confirmation link that we have sent you via email" mailer: confirmation_instructions: subject: "Confirmation instructions" diff --git a/config/locales/devise.es.yml b/config/locales/devise.es.yml index bf81e4199..9e5ad1f36 100644 --- a/config/locales/devise.es.yml +++ b/config/locales/devise.es.yml @@ -1,7 +1,7 @@ es: devise: confirmations: - confirmed: "Tu cuenta ha sido confirmada." + confirmed: "Tu cuenta ha sido confirmada. Por favor autentifícate con tu red social o tu usuario y contraseña" send_instructions: "Recibirás un correo electrónico en unos minutos con instrucciones sobre cómo restablecer tu contraseña." send_paranoid_instructions: "Si tu correo electrónico existe en nuestra base de datos recibirás un correo electrónico en unos minutos con instrucciones sobre cómo restablecer tu contraseña." failure: @@ -13,7 +13,7 @@ es: not_found_in_database: "%{authentication_keys} o contraseña inválidos." timeout: "Tu sesión ha expirado, por favor inicia sesión nuevamente para continuar." unauthenticated: "Necesitas iniciar sesión o registrarte para continuar." - unconfirmed: "Debes confirmar tu cuenta para continuar." + unconfirmed: "Para continuar, por favor pulsa en el enlace de confirmación que hemos enviado a tu cuenta de correo." mailer: confirmation_instructions: subject: "Instrucciones de confirmación" @@ -22,8 +22,8 @@ es: unlock_instructions: subject: "Instrucciones de desbloqueo" omniauth_callbacks: - failure: "No se te ha podido autorizar de %{kind} debido a \"%{reason}\"." - success: "Identificado correctamente de %{kind}." + failure: "No se te ha podido identificar via %{kind} por el siguiente motivo: \"%{reason}\"." + success: "Identificado correctamente via %{kind}." passwords: no_token: "No puedes acceder a esta página si no es a través de un enlace para restablecer la contraseña. Si has accedido desde el enlace para restablecer la contraseña, asegúrate de que la URL esté completa." send_instructions: "Recibirás un correo electrónico con instrucciones sobre cómo restablecer tu contraseña en unos minutos." diff --git a/config/locales/en.yml b/config/locales/en.yml index be80cb8a4..555b47413 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -477,13 +477,12 @@ en: facebook: sign_in: "Sign in with Facebook" sign_up: "Sign up with Facebook" - #google_oauth2: - # sign_in: "Sign in with Google" - # sign_up: "Sign up with Google" + google_oauth2: + sign_in: "Sign in with Google" + sign_up: "Sign up with Google" legislation: help: title: "How I can comment this document?" - text_logged: "Select the text you want to comment and press the button with the pencil." text: "To comment this document you must %{sign_in} or %{sign_up}. Then select the text you want to comment and press the button with the pencil." text_sign_in: "login" text_sign_up: "sign up" diff --git a/config/locales/es.yml b/config/locales/es.yml index 9ba8a24ef..87de46def 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -477,13 +477,12 @@ es: facebook: sign_in: "Entra con Facebook" sign_up: "Regístrate con Facebook" - #google_oauth2: - # sign_in: "Entra con Google" - # sign_up: "Regístrate con Google" + google_oauth2: + sign_in: "Entra con Google" + sign_up: "Regístrate con Google" legislation: help: title: "¿Cómo puedo comentar este documento?" - text_logged: "Selecciona el texto que quieres comentar y pulsa en el botón con el lápiz." text: "Para comentar este documento debes %{sign_in} o %{sign_up}. Después selecciona el texto que quieres comentar y pulsa en el botón con el lápiz." text_sign_in: "iniciar sesión" text_sign_up: "registrarte" diff --git a/spec/features/users_auth_spec.rb b/spec/features/users_auth_spec.rb index 831a2b0a5..7e874b06c 100644 --- a/spec/features/users_auth_spec.rb +++ b/spec/features/users_auth_spec.rb @@ -101,6 +101,8 @@ feature 'Users' do fill_in 'user_email', with: 'manueladelascarmenas@example.com' click_button 'Register' + expect(page).to have_content "To continue, please click on the confirmation link that we have sent you via email" + confirm_email expect(page).to have_content "Your email address has been successfully confirmed" @@ -173,7 +175,7 @@ feature 'Users' do fill_in 'user_email', with: 'somethingelse@example.com' click_button 'Register' - expect(page).to have_content "You must confirm your account to continue" + expect(page).to have_content "To continue, please click on the confirmation link that we have sent you via email" confirm_email expect(page).to have_content "Your account has been confirmed"