Skip to content

Commit 987fdbe

Browse files
committed
add unconfirmed acces env var to gala dev and staging
1 parent 313337e commit 987fdbe

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

app/views/application/_footer.html.haml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
target: '_blank', rel: 'noopener noreferrer'
1010
= link_to 'Open Source', 'https://github.com/galahq/gala',
1111
target: '_blank', rel: 'noopener noreferrer'
12-
%a{ href: "https://github.com/galahq/gala/releases/tag/#{ENV['RELEASE']}" }
13-
= ENV['RELEASE']
12+
- if ENV['RELEASE'].present?
13+
%a.footer__release{ href: "https://github.com/galahq/gala/releases/tag/#{ENV['RELEASE']}" }
14+
= ENV['RELEASE']

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
autocomplete: "new-password"
3434

3535
= f.submit t('.sign_up'), class: %w[pt-intent-primary]
36-
37-
%a.pt-button.pt-icon-log-in.oauth-icon-google{role: 'button',
38-
href: omniauth_authorize_path('authentication_strategy', 'google')}
39-
= t('devise.shared.links.sign_in_with_provider', provider: 'Google')
36+
- 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')}
39+
= t('devise.shared.links.sign_in_with_provider', provider: 'Google')
4040

4141
= render "devise/shared/links"

config/application.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@ class Application < Rails::Application
2626
config.middleware.use Rack::Deflater
2727
end
2828

29+
# Set release version
2930
ENV['RELEASE'] = 'v2.2.0' # TODO: experiment doing github releases again
3031

32+
# Determine if we're in staging environment
33+
ENV['STAGING'] = (ENV['BASE_URL']&.include?('staging')).to_s
34+
35+
# Allow temporary unconfirmed access in staging development
36+
ENV['TEMPORARY_UNCONFIRMED_ACCESS'] ||=
37+
(ENV['STAGING'] == 'true' && Rails.env.development?).to_s
3138
end
3239
end

config/initializers/devise.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@
115115
# able to access the website for two days without confirming their account,
116116
# access will be blocked just in the third day. Default is 0.days, meaning
117117
# the user cannot access the website without confirming their account.
118-
# config.allow_unconfirmed_access_for = 2.days
118+
unconfirmed = ENV['TEMPORARY_UNCONFIRMED_ACCESS'] == 'true'
119+
config.allow_unconfirmed_access_for = unconfirmed ? 7.days : 0.days
119120

120121
# A period that the user is allowed to confirm their account before their
121122
# token becomes invalid. For example, if set to 3.days, the user can confirm

0 commit comments

Comments
 (0)