Skip to content

Commit 03acde7

Browse files
committed
grey out google oauth buttons instead of hiding them out in staging ande
controlled in dev by env var
1 parent d1e6350 commit 03acde7

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

app/views/devise/registrations/new.html.haml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@
3131
= f.password_field :password_confirmation,
3232
class: %w[pt-input pt-fill] + error_classes,
3333
autocomplete: "new-password"
34-
3534
= f.submit t('.sign_up'), class: %w[pt-intent-primary]
3635
- if ENV['TEMPORARY_UNCONFIRMED_ACCESS'] == 'false'
37-
%a.pt-button.pt-icon-log-in.oauth-icon-google{role: 'button',
38-
href: omniauth_authorize_path('authentication_strategy', 'google')}
36+
%a.pt-button.pt-icon-log-in.oauth-icon-google{ role: 'button', tabindex: '0',
37+
href: omniauth_authorize_path('authentication_strategy', 'google') }
38+
= t('devise.shared.links.sign_in_with_provider', provider: 'Google')
39+
- else
40+
%a.pt-button.pt-icon-log-in.oauth-icon-google.pt-disabled{ role: 'button', tabindex: '-1',
41+
href: 'javascript:void(0)',
42+
style: 'pointer-events: none; opacity: 0.6;' }
3943
= t('devise.shared.links.sign_in_with_provider', provider: 'Google')
4044

4145
= render "devise/shared/links"

app/views/devise/sessions/_sign_in.html.haml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,10 @@
2020
%a.pt-button.pt-icon-log-in.oauth-icon-google{ role: 'button', tabindex: '0',
2121
href: omniauth_authorize_path('authentication_strategy', 'google') }
2222
= t('devise.shared.links.sign_in_with_provider', provider: 'Google')
23+
- else
24+
%a.pt-button.pt-icon-log-in.oauth-icon-google.pt-disabled{ role: 'button', tabindex: '-1',
25+
href: 'javascript:void(0)',
26+
style: 'pointer-events: none; opacity: 0.6;' }
27+
= t('devise.shared.links.sign_in_with_provider', provider: 'Google')
2328

2429
= render "devise/shared/links"

config/application.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

1212
# Set release version
1313
ENV['RELEASE'] = 'v2.2.0' # TODO: experiment doing github releases again
14+
1415
# Determine if we're in staging environment
1516
ENV['STAGING'] = (ENV['BASE_URL']&.include?('staging')).to_s
17+
1618
# Allow temporary unconfirmed access in staging or development
1719
ENV['TEMPORARY_UNCONFIRMED_ACCESS'] ||=
18-
(ENV['STAGING'] == 'true' || Rails.env.development?).to_s
19-
20-
puts [ENV['RELEASE'], ENV['STAGING'], ENV['TEMPORARY_UNCONFIRMED_ACCESS']].inspect
20+
(ENV['STAGING'] == 'true').to_s
2121

2222
module Orchard
2323
class Application < Rails::Application
@@ -35,6 +35,5 @@ class Application < Rails::Application
3535
unless ENV['SIDEKIQ_CONCURRENCY'].present?
3636
config.middleware.use Rack::Deflater
3737
end
38-
3938
end
4039
end

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ services:
1818
SIDEKIQ_CONCURRENCY: 1
1919
RUBY_YJIT_ENABLE: 1
2020
DOCKER_DEV: true
21+
TEMPORARY_UNCONFIRMED_ACCESS: false
2122
BASE_URL: http://localhost:3000
2223
PORT: 3000
2324
ports:

0 commit comments

Comments
 (0)