Skip to content

Commit

Permalink
do not show social login buttons for webview
Browse files Browse the repository at this point in the history
  • Loading branch information
ka8725 committed Feb 1, 2024
1 parent d0dd761 commit 7dc419a
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 32 deletions.
44 changes: 28 additions & 16 deletions app/views/devise/registrations/new.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@
h2.title.is-4.is-light = t('.sign_up')
h2.title.font-frank-ruhl-libre Get Started for free
- if Devise.omniauth_providers.include?(:google_oauth2)
.field
.buttons.is-centered
= button_to user_google_oauth2_omniauth_authorize_path, method: :post, class: 'button is-outlined', id: 'google-button' do
span
figure.image.is-24x24
= image_tag('google.svg', class:'is-rounded', alt: 'G')
|   Google
= button_to user_facebook_omniauth_authorize_path, method: :post, class: 'button is-outlined', id: 'facebook-button' do
span
figure.image.is-24x24
= image_tag('facebook.svg', class:'is-rounded', alt: 'F')
|   Facebook
br
p.text-divider
| Or continue with
br
.social-login-block
.field
.buttons.is-centered
= button_to user_google_oauth2_omniauth_authorize_path, method: :post, class: 'button is-outlined', id: 'google-button' do
span
figure.image.is-24x24
= image_tag('google.svg', class:'is-rounded', alt: 'G')
|   Google
= button_to user_facebook_omniauth_authorize_path, method: :post, class: 'button is-outlined', id: 'facebook-button' do
span
figure.image.is-24x24
= image_tag('facebook.svg', class:'is-rounded', alt: 'F')
|   Facebook
br
p.text-divider
| Or continue with
br
= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
= render "devise/shared/error_messages", resource: resource
.field
Expand Down Expand Up @@ -62,3 +63,14 @@
.column.has-background-image
figure.image.is-coins
= image_tag('coins.svg')

javascript:
document.addEventListener('turbolinks:load', function() {
const isWebView = navigator.userAgent.match(/(Android|iPhone|iPad|iPod)(.*wv)/gi) !== null;
console.log(isWebView)
if (isWebView) {
document.querySelector('.social-login-block').style.display = 'none';
}
});
44 changes: 28 additions & 16 deletions app/views/devise/sessions/new.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@
h2.title.is-4.is-light = t('.login')
h2.title.font-frank-ruhl-libre Login to your account
- if Devise.omniauth_providers.include?(:google_oauth2)
.field
.buttons.is-centered
= link_to user_google_oauth2_omniauth_authorize_path, method: :post, class: 'button is-outlined' do
span
figure.image.is-24x24
= image_tag('google.svg', class:'is-rounded', alt: 'G')
|   Google
= link_to user_facebook_omniauth_authorize_path, method: :post, class: 'button is-outlined' do
span
figure.image.is-24x24
= image_tag('facebook.svg', class:'is-rounded', alt: 'F')
|   Facebook
br
p.text-divider
| Or continue with
br
.social-login-block
.field
.buttons.is-centered
= link_to user_google_oauth2_omniauth_authorize_path, method: :post, class: 'button is-outlined' do
span
figure.image.is-24x24
= image_tag('google.svg', class:'is-rounded', alt: 'G')
|   Google
= link_to user_facebook_omniauth_authorize_path, method: :post, class: 'button is-outlined' do
span
figure.image.is-24x24
= image_tag('facebook.svg', class:'is-rounded', alt: 'F')
|   Facebook
br
p.text-divider
| Or continue with
br
= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
.field
= f.label :email
Expand Down Expand Up @@ -57,3 +58,14 @@
.column.has-background-image
figure.image.is-coins
= image_tag('coins.svg')

javascript:
document.addEventListener('turbolinks:load', function() {
const isWebView = navigator.userAgent.match(/(Android|iPhone|iPad|iPod)(.*wv)/gi) !== null;
console.log(isWebView)
if (isWebView) {
document.querySelector('.social-login-block').style.display = 'none';
}
});

0 comments on commit 7dc419a

Please sign in to comment.