Skip to content

Commit 02262a8

Browse files
committed
fix sign in form without oauth
1 parent a3d351f commit 02262a8

File tree

2 files changed

+24
-16
lines changed

2 files changed

+24
-16
lines changed

app/views/devise/registrations/show.html.erb

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,19 @@
1717
<% end %>
1818
<% if devise_mapping.omniauthable? %>
1919
<div class="space-y-4">
20-
<%= form_for '', url: omniauth_authorize_path(resource_name, :google_oauth2), data: { turbo: false }, method: :post do |f| %>
21-
<set-timezone data-input-id="state" data-params="true"></set-timezone>
22-
<%= hidden_field_tag :state, { redir: params[:redir].to_s }.compact_blank.to_query %>
23-
<%= f.button button_title(title: 'Sign up with Google', icon: svg_icon('brand_google', class: 'w-6 h-6')), class: 'white-button w-full mt-4' %>
20+
<% if User.omniauth_providers.include?(:google_oauth2) %>
21+
<%= form_for '', url: omniauth_authorize_path(resource_name, :google_oauth2), data: { turbo: false }, method: :post do |f| %>
22+
<set-timezone data-input-id="state" data-params="true"></set-timezone>
23+
<%= hidden_field_tag :state, { redir: params[:redir].to_s }.compact_blank.to_query %>
24+
<%= f.button button_title(title: 'Sign up with Google', icon: svg_icon('brand_google', class: 'w-6 h-6')), class: 'white-button w-full mt-4' %>
25+
<% end %>
2426
<% end %>
25-
<%= form_for '', url: omniauth_authorize_path(resource_name, :microsoft_office365), data: { turbo: false }, method: :post do |f| %>
26-
<set-timezone data-input-id="state_microsoft" data-params="true"></set-timezone>
27-
<%= hidden_field_tag :state, { redir: params[:redir].to_s }.compact_blank.to_query, id: 'state_microsoft' %>
28-
<%= f.button button_title(title: 'Sign up with Microsoft', icon: svg_icon('brand_microsoft', class: 'w-6 h-6')), class: 'white-button w-full' %>
27+
<% if User.omniauth_providers.include?(:microsoft_office365) %>
28+
<%= form_for '', url: omniauth_authorize_path(resource_name, :microsoft_office365), data: { turbo: false }, method: :post do |f| %>
29+
<set-timezone data-input-id="state_microsoft" data-params="true"></set-timezone>
30+
<%= hidden_field_tag :state, { redir: params[:redir].to_s }.compact_blank.to_query, id: 'state_microsoft' %>
31+
<%= f.button button_title(title: 'Sign up with Microsoft', icon: svg_icon('brand_microsoft', class: 'w-6 h-6')), class: 'white-button w-full' %>
32+
<% end %>
2933
<% end %>
3034
</div>
3135
<% end %>

app/views/devise/sessions/new.html.erb

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,19 @@
2121
<% end %>
2222
<% if devise_mapping.omniauthable? %>
2323
<div class="space-y-4">
24-
<%= form_for '', url: omniauth_authorize_path(resource_name, :google_oauth2), data: { turbo: false }, method: :post do |f| %>
25-
<set-timezone data-input-id="state" data-params="true"></set-timezone>
26-
<%= hidden_field_tag :state, { redir: params[:redir].to_s }.compact_blank.to_query %>
27-
<%= f.button button_title(title: 'Sign in with Google', icon: svg_icon('brand_google', class: 'w-6 h-6')), class: 'white-button w-full mt-4' %>
24+
<% if User.omniauth_providers.include?(:google_oauth2) %>
25+
<%= form_for '', url: omniauth_authorize_path(resource_name, :google_oauth2), data: { turbo: false }, method: :post do |f| %>
26+
<set-timezone data-input-id="state" data-params="true"></set-timezone>
27+
<%= hidden_field_tag :state, { redir: params[:redir].to_s }.compact_blank.to_query %>
28+
<%= f.button button_title(title: 'Sign in with Google', icon: svg_icon('brand_google', class: 'w-6 h-6')), class: 'white-button w-full mt-4' %>
29+
<% end %>
2830
<% end %>
29-
<%= form_for '', url: omniauth_authorize_path(resource_name, :microsoft_office365), data: { turbo: false }, method: :post do |f| %>
30-
<set-timezone data-input-id="state_microsoft" data-params="true"></set-timezone>
31-
<%= hidden_field_tag :state, { redir: params[:redir].to_s }.compact_blank.to_query, id: 'state_microsoft' %>
32-
<%= f.button button_title(title: 'Sign in with Microsoft', icon: svg_icon('brand_microsoft', class: 'w-6 h-6')), class: 'white-button w-full' %>
31+
<% if User.omniauth_providers.include?(:microsoft_office365) %>
32+
<%= form_for '', url: omniauth_authorize_path(resource_name, :microsoft_office365), data: { turbo: false }, method: :post do |f| %>
33+
<set-timezone data-input-id="state_microsoft" data-params="true"></set-timezone>
34+
<%= hidden_field_tag :state, { redir: params[:redir].to_s }.compact_blank.to_query, id: 'state_microsoft' %>
35+
<%= f.button button_title(title: 'Sign in with Microsoft', icon: svg_icon('brand_microsoft', class: 'w-6 h-6')), class: 'white-button w-full' %>
36+
<% end %>
3337
<% end %>
3438
</div>
3539
<% end %>

0 commit comments

Comments
 (0)