use devise instead auth0

This commit is contained in:
João Geonizeli
2021-08-09 22:07:48 -03:00
parent 15abf28e80
commit 645b818f6c
48 changed files with 519 additions and 399 deletions

View File

@@ -1,16 +1,16 @@
<h1><%= t('.resend_confirmation_instructions') %></h1>
<h2><%= t('.resend_confirmation_instructions') %></h2>
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
<%= bootstrap_devise_error_messages! %>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="form-group">
<%= f.label :email %>
<%= f.email_field :email, autofocus: true, autocomplete: 'email', value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email), class: 'form-control' %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
</div>
<div class="form-group">
<%= f.submit t('.resend_confirmation_instructions'), class: 'btn btn-primary' %>
<div class="actions">
<%= f.submit t('.resend_confirmation_instructions') %>
</div>
<% end %>
<%= render 'devise/shared/links' %>
<%= render "devise/shared/links" %>

View File

@@ -0,0 +1,5 @@
<p><%= t('.greeting', recipient: @email) %></p>
<p><%= t('.instruction') %></p>
<p><%= link_to t('.action'), confirmation_url(@resource, confirmation_token: @token) %></p>

View File

@@ -0,0 +1,7 @@
<p><%= t('.greeting', recipient: @email) %></p>
<% if @resource.try(:unconfirmed_email?) %>
<p><%= t('.message_unconfirmed', email: @resource.unconfirmed_email) %></p>
<% else %>
<p><%= t('.message', email: @resource.email) %></p>
<% end %>

View File

@@ -0,0 +1,3 @@
<p><%= t('.greeting', recipient: @resource.email) %></p>
<p><%= t('.message') %></p>

View File

@@ -0,0 +1,8 @@
<p><%= t('.greeting', recipient: @resource.email) %></p>
<p><%= t('.instruction') %></p>
<p><%= link_to t('.action'), edit_password_url(@resource, reset_password_token: @token) %></p>
<p><%= t('.instruction_2') %></p>
<p><%= t('.instruction_3') %></p>

View File

@@ -0,0 +1,7 @@
<p><%= t('.greeting', recipient: @resource.email) %></p>
<p><%= t('.message') %></p>
<p><%= t('.instruction') %></p>
<p><%= link_to t('.action'), unlock_url(@resource, unlock_token: @token) %></p>

View File

@@ -1,26 +1,25 @@
<h1><%= t('.change_your_password') %></h1>
<h2><%= t('.change_your_password') %></h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<%= bootstrap_devise_error_messages! %>
<%= render "devise/shared/error_messages", resource: resource %>
<%= f.hidden_field :reset_password_token %>
<div class="form-group">
<%= f.label :password, t('.new_password') %>
<%= f.password_field :password, autofocus: true, class: 'form-control' %>
<div class="field">
<%= f.label :password, t('.new_password') %><br />
<% if @minimum_password_length %>
<small class="form-text text-muted"><%= t('devise.shared.minimum_password_length', count: @minimum_password_length) %></small>
<em><%= t('devise.shared.minimum_password_length', count: @minimum_password_length) %></em><br />
<% end %>
<%= f.password_field :password, autofocus: true, autocomplete: "new-password" %>
</div>
<div class="form-group">
<%= f.label :password_confirmation, t('.confirm_new_password') %>
<%= f.password_field :password_confirmation, autocomplete: 'off', class: 'form-control' %>
<div class="field">
<%= f.label :password_confirmation, t('.confirm_new_password') %><br />
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
</div>
<div class="form-group">
<%= f.submit t('.change_my_password'), class: 'btn btn-primary' %>
<div class="actions">
<%= f.submit t('.change_my_password') %>
</div>
<% end %>
<%= render 'devise/shared/links' %>
<%= render "devise/shared/links" %>

View File

@@ -1,16 +1,16 @@
<h1><%= t('.forgot_your_password') %></h1>
<h2><%= t('.forgot_your_password') %></h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
<%= bootstrap_devise_error_messages! %>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="form-group">
<%= f.label :email %>
<%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control' %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
</div>
<div class="form-group">
<%= f.submit t('.send_me_reset_password_instructions'), class: 'btn btn-primary' %>
<div class="actions">
<%= f.submit t('.send_me_reset_password_instructions') %>
</div>
<% end %>
<%= render 'devise/shared/links' %>
<%= render "devise/shared/links" %>

View File

@@ -1,37 +1,43 @@
<h1><%= t('.title', resource: resource_name.to_s.humanize) %></h1>
<h2><%= t('.title', resource: resource.model_name.human) %></h2>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= bootstrap_devise_error_messages! %>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="form-group">
<%= f.label :email %>
<%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control' %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
</div>
<div class="form-group">
<%= f.label :password %>
<%= f.password_field :password, autocomplete: 'new-password', class: 'form-control' %>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div><%= t('.currently_waiting_confirmation_for_email', email: resource.unconfirmed_email) %></div>
<% end %>
<small class="form-text text-muted"><%= t('.leave_blank_if_you_don_t_want_to_change_it') %></small>
<div class="field">
<%= f.label :password %> <i>(<%= t('.leave_blank_if_you_don_t_want_to_change_it') %>)</i><br />
<%= f.password_field :password, autocomplete: "new-password" %>
<% if @minimum_password_length %>
<br />
<em><%= t('devise.shared.minimum_password_length', count: @minimum_password_length) %></em>
<% end %>
</div>
<div class="form-group">
<%= f.label :password_confirmation %>
<%= f.password_field :password_confirmation, autocomplete: 'new-password', class: 'form-control' %>
<div class="field">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
</div>
<div class="form-group">
<%= f.label :current_password %>
<%= f.password_field :current_password, autocomplete: 'current-password', class: 'form-control' %>
<small class="form-text text-muted"><%= t('.we_need_your_current_password_to_confirm_your_changes') %></small>
<div class="field">
<%= f.label :current_password %> <i>(<%= t('.we_need_your_current_password_to_confirm_your_changes') %>)</i><br />
<%= f.password_field :current_password, autocomplete: "current-password" %>
</div>
<div class="form-group">
<%= f.submit t('.update'), class: 'btn btn-primary' %>
<div class="actions">
<%= f.submit t('.update') %>
</div>
<% end %>
<p><%= t('.unhappy') %>? <%= link_to t('.cancel_my_account'), registration_path(resource_name), data: { confirm: t('.are_you_sure') }, method: :delete %>.</p>
<h3><%= t('.cancel_my_account') %></h3>
<%= link_to t('.back'), :back %>
<p><%= t('.unhappy') %> <%= button_to t('.cancel_my_account'), registration_path(resource_name), data: { confirm: t('.are_you_sure') }, method: :delete %></p>
<%= link_to t('devise.shared.links.back'), :back %>

View File

@@ -1,30 +1,39 @@
<h1><%= t('.sign_up') %></h1>
<h2><%= t('.sign_up') %></h2>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= bootstrap_devise_error_messages! %>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="form-group">
<%= f.label :email %>
<%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control' %>
<div class="field">
<%= f.label :first_name %><br />
<%= f.text_field :first_name, autofocus: true %>
</div>
<div class="form-group">
<div class="field">
<%= f.label :last_name %><br />
<%= f.text_field :last_name %>
</div>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autocomplete: "email" %>
</div>
<div class="field">
<%= f.label :password %>
<%= f.password_field :password, autocomplete: 'current-password', class: 'form-control' %>
<% if @minimum_password_length %>
<small class="form-text text-muted"><%= t('devise.shared.minimum_password_length', count: @minimum_password_length) %></small>
<% end %>
<em><%= t('devise.shared.minimum_password_length', count: @minimum_password_length) %></em>
<% end %><br />
<%= f.password_field :password, autocomplete: "new-password" %>
</div>
<div class="form-group">
<%= f.label :password_confirmation %>
<%= f.password_field :password_confirmation, autocomplete: 'current-password', class: 'form-control' %>
<div class="field">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
</div>
<div class="form-group">
<%= f.submit t('.sign_up'), class: 'btn btn-primary' %>
<div class="actions">
<%= f.submit t('.sign_up') %>
</div>
<% end %>
<%= render 'devise/shared/links' %>
<%= render "devise/shared/links" %>

View File

@@ -1,28 +1,26 @@
<h1><%= t('.sign_in') %></h1>
<h2><%= t('.sign_in') %></h2>
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="form-group">
<%= f.label :email %>
<%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control' %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
</div>
<div class="form-group">
<%= f.label :password %>
<%= f.password_field :password, autocomplete: 'current-password', class: 'form-control' %>
<div class="field">
<%= f.label :password %><br />
<%= f.password_field :password, autocomplete: "current-password" %>
</div>
<% if devise_mapping.rememberable? %>
<div class="form-group form-check">
<%= f.check_box :remember_me, class: 'form-check-input' %>
<%= f.label :remember_me, class: 'form-check-label' do %>
<%= resource.class.human_attribute_name('remember_me') %>
<% end %>
<div class="field">
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
</div>
<% end %>
<div class="form-group">
<%= f.submit t('.sign_in'), class: 'btn btn-primary' %>
<div class="actions">
<%= f.submit t('.sign_in') %>
</div>
<% end %>
<%= render 'devise/shared/links' %>
<%= render "devise/shared/links" %>

View File

@@ -0,0 +1,15 @@
<% if resource.errors.any? %>
<div id="error_explanation">
<h2>
<%= I18n.t("errors.messages.not_saved",
count: resource.errors.count,
resource: resource.class.model_name.human.downcase)
%>
</h2>
<ul>
<% resource.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>

View File

@@ -1,27 +1,25 @@
<div class="form-group">
<%- if controller_name != 'sessions' %>
<%= link_to t(".sign_in"), new_session_path(resource_name) %><br />
<% end -%>
<%- if controller_name != 'sessions' %>
<%= link_to t(".sign_in"), new_session_path(resource_name) %><br />
<% end %>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to t(".sign_up"), new_registration_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to t(".sign_up"), new_registration_path(resource_name) %><br />
<% end %>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to t(".forgot_your_password"), new_password_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to t(".forgot_your_password"), new_password_path(resource_name) %><br />
<% end %>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to t('.didn_t_receive_confirmation_instructions'), new_confirmation_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to t('.didn_t_receive_confirmation_instructions'), new_confirmation_path(resource_name) %><br />
<% end %>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to t('.didn_t_receive_unlock_instructions'), new_unlock_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to t('.didn_t_receive_unlock_instructions'), new_unlock_path(resource_name) %><br />
<% end %>
<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
<%= link_to t('.sign_in_with_provider', provider: OmniAuth::Utils.camelize(provider)), omniauth_authorize_path(resource_name, provider) %><br />
<% end -%>
<% end -%>
</div>
<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
<%= link_to t('.sign_in_with_provider', provider: OmniAuth::Utils.camelize(provider)), omniauth_authorize_path(resource_name, provider), method: :post %><br />
<% end %>
<% end %>

View File

@@ -1,16 +1,16 @@
<h1><%= t('.resend_unlock_instructions') %></h1>
<h2><%= t('.resend_unlock_instructions') %></h2>
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
<%= bootstrap_devise_error_messages! %>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="form-group">
<%= f.label :email %>
<%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control' %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
</div>
<div class="form-group">
<%= f.submit t('.resend_unlock_instructions'), class: 'btn btn-primary'%>
<div class="actions">
<%= f.submit t('.resend_unlock_instructions') %>
</div>
<% end %>
<%= render 'devise/shared/links' %>
<%= render "devise/shared/links" %>

View File

@@ -7,15 +7,7 @@
<%= csp_meta_tag %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<script>
window.AUTH_DOMAIN = "<%= ENV['AUTH_DOMAIN'] %>"
window.AUTH_CLIENT_ID = "<%= ENV['AUTH_CLIENT_ID'] %>"
window.AUTH_AUDIENCE = "<%= ENV['AUTH_AUDIENCE'] %>"
</script>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'react', 'data-turbolinks-track': 'reload' %>
</head>
<body>