Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix-video-aspect-ratio #1448

Open
wants to merge 6 commits into
base: sandbox
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions services/catarse/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,16 @@ gem 'video_info', '3.0.1'
gem 'webpacker', '5.4.3', require: false
gem 'whenever', '1.0.0'
gem 'zendesk_api', '1.33.0'
gem "recaptcha"

group :production do
gem 'fog-aws', '3.12.0'
end

group :production, :sandbox do
gem 'cloudflare-rails'
end

group :development do
gem 'brakeman', '5.1.2'
gem 'letter_opener', '1.7.0'
Expand Down
7 changes: 7 additions & 0 deletions services/catarse/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ GEM
chronic_duration (0.10.6)
numerizer (~> 0.1.1)
chunky_png (1.4.0)
cloudflare-rails (3.0.0)
actionpack (>= 6.0, < 7.1.0)
activesupport (>= 6.0, < 7.1.0)
railties (>= 6.0, < 7.1.0)
concurrent-ruby (1.1.9)
connection_pool (2.2.5)
countries (4.0.1)
Expand Down Expand Up @@ -473,6 +477,7 @@ GEM
ffi (~> 1.0)
rdstation-ruby-client (0.0.5)
httparty (~> 0.12)
recaptcha (5.14.0)
redcarpet (3.5.1)
redis (4.5.1)
regexp_parser (2.2.0)
Expand Down Expand Up @@ -674,6 +679,7 @@ DEPENDENCIES
catarse_pagarme!
catarse_scripts!
catarse_settings_db (= 0.2.0)
cloudflare-rails
concurrent-ruby (= 1.1.9)
countries (= 4.0.1)
cpf_cnpj (= 0.5.0)
Expand Down Expand Up @@ -718,6 +724,7 @@ DEPENDENCIES
rails-observers (= 0.1.5)
ranked-model (= 0.4.7)
rdstation-ruby-client (= 0.0.5)
recaptcha
redactor-rails (= 0.7.0)!
redis (= 4.5.1)
responders (= 3.0.1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -737,9 +737,10 @@ a:hover {
}

.project-video {
height: 488px;
height: auto;
margin-bottom: 30px;
background-color: hsla(0, 0%, 87.1%, 0.57);
aspect-ratio: 16 / 9;
}

.fontsize-smaller {
Expand Down Expand Up @@ -5106,7 +5107,7 @@ html.w-mod-js *[data-ix="display-0-on-load"] {
margin-top: 8px;
}
.project-video {
height: 358px;
height: auto;
}
.fontsize-smaller {
font-size: 13px;
Expand Down
19 changes: 19 additions & 0 deletions services/catarse/app/controllers/registrations_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

class RegistrationsController < Devise::RegistrationsController
prepend_before_action :check_captcha, only: [:create]
private

def check_captcha
return if verify_recaptcha # verify_recaptcha(action: 'signup') for v3

self.resource = resource_class.new sign_up_params
resource.validate
set_minimum_password_length

respond_with_navigational(resource) do
flash.discard(:recaptcha_error)
render :new
end
end
end
8 changes: 7 additions & 1 deletion services/catarse/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def generate_reset_password_token

def update_tracked_fields(request)
super
login_activities.build(ip_address: current_sign_in_ip)
login_activities.build(ip_address: (request.headers['CF-Connecting-IP'].presence || current_sign_in_ip))
end

def account_active?
Expand Down Expand Up @@ -521,4 +521,10 @@ def cancel_all_subscriptions
common_wrapper.cancel_subscription(_sub)
end
end

protected

def extract_ip_from(request)
request.headers['CF-Connecting-IP'].presence || request.remote_ip
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,11 @@
.w-col.w-col-6.box-login.w-col-push-3
.fontweight-semibold.u-text-center.fontsize-large.u-marginbottom-30= t '.titles.header'
.w-row
.w-col.w-col-6
.w-col.w-col-12
.login-oauth
= button_to user_google_oauth2_omniauth_authorize_path(locale: nil), class: 'btn btn-medium btn-google w-inline-block', :data_onsuccess => 'onSignIn'
img.google-icon[src="/assets/catarse_bootstrap/google-icon.png" loading="lazy"]
div = t('.form.inputs.google')
.w-col.w-col-6
.login-oauth
= button_to user_facebook_omniauth_authorize_path(locale: nil), class: 'btn btn-medium btn-fb btn-fb-flex'
span.fa.fa-facebook-f&nbsp;
text = t('.form.inputs.facebook')
.separator
.text.or = t('or')
.w-form
Expand All @@ -33,6 +28,8 @@
.u-marginbottom-20
= form.input_field :newsletter, as: :boolean, boolean_style: :inline, class: 'checkbox-fix', checked: false
label.w-form-label.fontsize-smallest= t('.form.labels.newsletter')
.u-marginbottom-20
= recaptcha_tags
.w-row.u-marginbottom-20
.w-col.w-col-6.w-col-small-6.w-col-tiny-6
= form.button :submit, t('.form.inputs.submit'), class:'btn btn-large'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@
.u-marginbottom-30
.fontweight-semibold.u-text-center.fontsize-large= t '.titles.header'
.w-row
.w-col.w-col-6
.w-col.w-col-12
.login-oauth
= button_to user_google_oauth2_omniauth_authorize_path(locale: nil), class: 'btn btn-medium btn-google w-inline-block', :data_onsuccess => 'onSignIn'
img.google-icon[src="/assets/catarse_bootstrap/google-icon.png" loading="lazy"]
div = t('.form.inputs.google')
.w-col.w-col-6
.login-oauth
= button_to user_facebook_omniauth_authorize_path(locale: nil), class: 'btn btn-medium btn-fb'
span.fa.fa-facebook-f&nbsp;
text = t('.form.inputs.facebook')
.separator
.text.or= t('or')
.w-form
Expand Down
4 changes: 2 additions & 2 deletions services/catarse/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ def matches?(request)
devise_for(:users,
path: '',
path_names: { sign_in: :login, sign_out: :logout, sign_up: :sign_up },
controllers: { passwords: :passwords, sessions: :sessions },
controllers: { passwords: :passwords, sessions: :sessions, registrations: :registrations },
skip: :omniauth_callbacks
)

devise_scope :user do
post '/sign_up', { to: 'devise/registrations#create', as: :sign_up }
post '/sign_up', { to: 'registrations#create', as: :sign_up }
get '/not-my-account', to: 'sessions#destroy_and_redirect', as: :not_my_account
end

Expand Down