mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 19:27:52 +01:00
Add default OAuths (#259)
This commit is contained in:
committed by
GitHub
parent
0828c9c879
commit
653e139a9e
@@ -1,55 +1,49 @@
|
||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
||||
<h2><%= t('common.forms.auth.sign_up') %></h2>
|
||||
<div class="new_user">
|
||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { class: "new_user_form" }) do |f| %>
|
||||
<h2><%= t('common.forms.auth.sign_up') %></h2>
|
||||
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.label :full_name, class: "sr-only" %>
|
||||
<%= f.text_field :full_name,
|
||||
autofocus: true,
|
||||
placeholder: t('common.forms.auth.full_name'),
|
||||
required: true,
|
||||
class: "form-control" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.label :full_name, class: "sr-only" %>
|
||||
<%= f.text_field :full_name,
|
||||
autofocus: true,
|
||||
placeholder: t('common.forms.auth.full_name'),
|
||||
required: true,
|
||||
class: "form-control" %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.label :email, class: "sr-only" %>
|
||||
<%= f.email_field :email,
|
||||
autocomplete: "email",
|
||||
placeholder: t('common.forms.auth.email'),
|
||||
required: true,
|
||||
class: "form-control" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.label :email, class: "sr-only" %>
|
||||
<%= f.email_field :email,
|
||||
autocomplete: "email",
|
||||
placeholder: t('common.forms.auth.email'),
|
||||
required: true,
|
||||
class: "form-control" %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.label :password, class: "sr-only" %>
|
||||
<%= f.password_field :password,
|
||||
placeholder: t('common.forms.auth.password'),
|
||||
required: true,
|
||||
class: "form-control" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.label :password, class: "sr-only" %>
|
||||
<%= f.password_field :password,
|
||||
placeholder: t('common.forms.auth.password'),
|
||||
required: true,
|
||||
class: "form-control" %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.label :password_confirmation, class: "sr-only" %>
|
||||
<%= f.password_field :password_confirmation,
|
||||
placeholder: t('common.forms.auth.password_confirmation'),
|
||||
required: true,
|
||||
class: "form-control" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.label :password_confirmation, class: "sr-only" %>
|
||||
<%= f.password_field :password_confirmation,
|
||||
placeholder: t('common.forms.auth.password_confirmation'),
|
||||
required: true,
|
||||
class: "form-control" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit t('common.forms.auth.sign_up'), class: "btn btn-dark btn-block" %>
|
||||
</div>
|
||||
|
||||
<% if not @o_auths.blank? %>
|
||||
<hr />
|
||||
<% @o_auths.each do |o_auth| %>
|
||||
<p>
|
||||
<%= link_to t('common.forms.auth.sign_up_with', o_auth: o_auth.name),
|
||||
o_auth_start_path(o_auth, reason: 'user') %>
|
||||
</p>
|
||||
<% end %>
|
||||
<div class="actions">
|
||||
<%= f.submit t('common.forms.auth.sign_up'), class: "btn btn-dark btn-block" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/o_auths", is_sign_up: true %>
|
||||
</div>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
|
||||
@@ -1,44 +1,38 @@
|
||||
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
||||
<h2><%= t('common.forms.auth.log_in') %></h2>
|
||||
<div class="new_user">
|
||||
<%= form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: "new_user_form" }) do |f| %>
|
||||
<h2><%= t('common.forms.auth.log_in') %></h2>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.label :email, class: "sr-only" %>
|
||||
<%= f.email_field :email,
|
||||
autocomplete: "email",
|
||||
placeholder: t('common.forms.auth.email'),
|
||||
required: true,
|
||||
class: "form-control" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.label :email, class: "sr-only" %>
|
||||
<%= f.email_field :email,
|
||||
autocomplete: "email",
|
||||
placeholder: t('common.forms.auth.email'),
|
||||
required: true,
|
||||
class: "form-control" %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.label :password, class: "sr-only" %>
|
||||
<%= f.password_field :password,
|
||||
autocomplete: "current-password",
|
||||
placeholder: t('common.forms.auth.password'),
|
||||
required: true,
|
||||
class: "form-control" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.label :password, class: "sr-only" %>
|
||||
<%= f.password_field :password,
|
||||
autocomplete: "current-password",
|
||||
placeholder: t('common.forms.auth.password'),
|
||||
required: true,
|
||||
class: "form-control" %>
|
||||
</div>
|
||||
|
||||
<% if devise_mapping.rememberable? %>
|
||||
<div class="form-group form-check">
|
||||
<%= f.check_box :remember_me, class: "form-check-input" %>
|
||||
<%= f.label :remember_me, t('common.forms.auth.remember_me'), class: "form-check-label" %>
|
||||
<% if devise_mapping.rememberable? %>
|
||||
<div class="form-group form-check">
|
||||
<%= f.check_box :remember_me, class: "form-check-input" %>
|
||||
<%= f.label :remember_me, t('common.forms.auth.remember_me'), class: "form-check-label" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit t('common.forms.auth.log_in'), class: "btn btn-dark btn-block" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit t('common.forms.auth.log_in'), class: "btn btn-dark btn-block" %>
|
||||
</div>
|
||||
|
||||
<% if not @o_auths.empty? %>
|
||||
<hr />
|
||||
<% @o_auths.each do |o_auth| %>
|
||||
<p>
|
||||
<%= link_to t('common.forms.auth.log_in_with', o_auth: o_auth.name),
|
||||
o_auth_start_path(o_auth, reason: 'user') %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= render "devise/shared/o_auths" %>
|
||||
</div>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
17
app/views/devise/shared/_o_auths.html.erb
Normal file
17
app/views/devise/shared/_o_auths.html.erb
Normal file
@@ -0,0 +1,17 @@
|
||||
<% if not @o_auths.blank? %>
|
||||
<hr />
|
||||
<% @o_auths.each do |o_auth| %>
|
||||
<%=
|
||||
react_component(
|
||||
'common/OAuthProviderLink',
|
||||
{
|
||||
oAuthId: o_auth.id,
|
||||
oAuthName: o_auth.name,
|
||||
oAuthLogo: o_auth.logo,
|
||||
oAuthReason: "login",
|
||||
isSignUp: defined?(is_sign_up) ? is_sign_up : false,
|
||||
}
|
||||
)
|
||||
%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -2,6 +2,11 @@
|
||||
react_component(
|
||||
'TenantSignUp',
|
||||
{
|
||||
oAuths: @o_auths || [],
|
||||
oAuthLoginCompleted: @o_auth_login_completed || false,
|
||||
oauthUserEmail: @user_email,
|
||||
oauthUserName: @user_name,
|
||||
baseUrl: Rails.application.base_url,
|
||||
authenticityToken: form_authenticity_token
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user