From ad83463919dd46bcadfbd8ab6778fd2d2c962a9b Mon Sep 17 00:00:00 2001 From: Dale Zak Date: Thu, 10 Feb 2022 10:03:01 -0600 Subject: [PATCH] Updated devise views --- Gemfile | 2 +- Gemfile.lock | 13 ++- app/models/likes/like.rb | 2 +- app/models/users/user.rb | 16 +--- app/views/devise/confirmations/new.html.erb | 38 ++++---- app/views/devise/passwords/edit.html.erb | 55 +++++------ app/views/devise/passwords/new.html.erb | 38 ++++---- app/views/devise/registrations/edit.html.erb | 92 +++++++++---------- app/views/devise/registrations/new.html.erb | 65 ++++++------- app/views/devise/sessions/new.html.erb | 55 +++++------ app/views/devise/shared/_links.html.erb | 12 +-- app/views/devise/unlocks/new.html.erb | 36 ++++---- app/views/partials/_footer.html.erb | 5 + app/views/partials/_match.html.erb | 2 +- app/views/partials/_navbar.html.erb | 6 ++ app/views/users/profile.html.erb | 2 + config/locales/devise.en.yml | 67 -------------- config/locales/devise_invitable.en.yml | 31 ------- ...111131447_devise_invitable_add_to_users.rb | 22 ----- db/schema.rb | 11 --- db/seeds/02_gems.rb | 1 + test/fixtures/users.yml | 11 --- test/models/user_test.rb | 11 --- 23 files changed, 229 insertions(+), 364 deletions(-) delete mode 100644 config/locales/devise.en.yml delete mode 100644 config/locales/devise_invitable.en.yml delete mode 100644 db/migrate/20220111131447_devise_invitable_add_to_users.rb diff --git a/Gemfile b/Gemfile index 3ed4e55..313a326 100644 --- a/Gemfile +++ b/Gemfile @@ -76,7 +76,7 @@ end gem 'devise', '~> 4.8', '>= 4.8.1' -gem "devise_invitable", "~> 2.0" +gem 'devise-i18n' gem "cancancan", "~> 3.3" diff --git a/Gemfile.lock b/Gemfile.lock index 7a25943..f8564af 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -68,9 +68,9 @@ GEM tzinfo (~> 2.0) addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) - annotate (2.6.5) - activerecord (>= 2.3.0) - rake (>= 0.8.7) + annotate (3.2.0) + activerecord (>= 3.2, < 8.0) + rake (>= 10.4, < 14.0) aws-eventstream (1.2.0) aws-partitions (1.553.0) aws-sdk-core (3.126.0) @@ -121,9 +121,8 @@ GEM responders warden (~> 1.2.3) devise-bootstrap5 (0.1.3) - devise_invitable (2.0.6) - actionmailer (>= 5.0) - devise (>= 4.6) + devise-i18n (1.10.1) + devise (>= 4.8.0) digest (3.1.0) down (5.2.4) addressable (~> 2.8) @@ -335,7 +334,7 @@ DEPENDENCIES debug devise (~> 4.8, >= 4.8.1) devise-bootstrap5 (~> 0.1.3) - devise_invitable (~> 2.0) + devise-i18n faker (~> 2.19) fastimage (~> 2.2) gems diff --git a/app/models/likes/like.rb b/app/models/likes/like.rb index 62bcb33..c7bf3eb 100644 --- a/app/models/likes/like.rb +++ b/app/models/likes/like.rb @@ -29,7 +29,7 @@ class Like < ApplicationRecord scope :for_gems, ->(gems) { where(gem_id: gems.pluck(:id)) if gems.present? } def update_user - self.user.update(gem_names: self.user.gems.map{|gem| gem.name}) + self.user.update(gem_list: self.user.gems.map{|gem| gem.name}) end end diff --git a/app/models/users/user.rb b/app/models/users/user.rb index ffb9b38..c532837 100644 --- a/app/models/users/user.rb +++ b/app/models/users/user.rb @@ -23,22 +23,11 @@ # likes_count :integer default("0") # created_at :datetime not null # updated_at :datetime not null -# invitation_token :string -# invitation_created_at :datetime -# invitation_sent_at :datetime -# invitation_accepted_at :datetime -# invitation_limit :integer -# invited_by_type :string -# invited_by_id :integer -# invitations_count :integer default("0") # identities_count :integer default("0") # # Indexes # # index_users_on_email (email) UNIQUE -# index_users_on_invitation_token (invitation_token) UNIQUE -# index_users_on_invited_by (invited_by_type,invited_by_id) -# index_users_on_invited_by_id (invited_by_id) # index_users_on_name (name) # index_users_on_reset_password_token (reset_password_token) UNIQUE # index_users_on_slug (slug) @@ -52,14 +41,13 @@ class User < ApplicationRecord include ::Imageable include ImageUploader::Attachment(:image) - # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable - devise :invitable, :database_authenticatable, :omniauthable, :registerable, :recoverable, :rememberable, :validatable + devise :database_authenticatable, :omniauthable, :registerable, :recoverable, :rememberable, :validatable store_attribute :details, :location, :string store_attribute :details, :homepage_uri, :string store_attribute :details, :github_uri, :string store_attribute :details, :twitter_uri, :string - store_attribute :details, :gem_names, :json, default: [] + store_attribute :details, :gem_list, :json, default: [] has_many :identities, dependent: :destroy diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb index 7b0d265..7961b04 100644 --- a/app/views/devise/confirmations/new.html.erb +++ b/app/views/devise/confirmations/new.html.erb @@ -1,20 +1,24 @@
-
-

<%= t('.resend_confirmation_instructions') %>

- - <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> - <%= render "devise/shared/error_messages", resource: resource %> - -
- <%= f.label :email, class: "form-label" %> - <%= f.email_field :email, autofocus: true, autocomplete: 'email', value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email), class: 'form-control' %> +
+
+
+

<%= t('.resend_confirmation_instructions') %>

- -
- <%= f.submit t('.resend_confirmation_instructions'), class: 'btn btn-primary' %> +
+ <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> + <%= render "devise/shared/error_messages", resource: resource %> +
+ <%= f.label :email, class: "form-label" %> + <%= f.email_field :email, autofocus: true, autocomplete: 'email', value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email), class: 'form-control' %> +
+
+ <%= f.submit t('.resend_confirmation_instructions'), class: 'btn btn-primary' %> +
+ <% end %>
- <% end %> - - <%= render "devise/shared/links" %> -
-
+ +
+
+
\ No newline at end of file diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb index 624d520..1b90dbe 100644 --- a/app/views/devise/passwords/edit.html.erb +++ b/app/views/devise/passwords/edit.html.erb @@ -1,31 +1,32 @@
-
- -

<%= t('.change_your_password') %>

- - <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> - <%= render "devise/shared/error_messages", resource: resource %> - <%= f.hidden_field :reset_password_token %> - -
- <%= f.label :password, t('.new_password'), class: 'form-label' %> - <%= f.password_field :password, autofocus: true, class: 'form-control' %> - - <% if @minimum_password_length %> -
<%= t('devise.shared.minimum_password_length', count: @minimum_password_length) %>
- <% end %> +
+
+
+

<%= t('.change_your_password') %>

- -
- <%= f.label :password_confirmation, t('.confirm_new_password'), class: 'form-label' %> - <%= f.password_field :password_confirmation, autocomplete: 'off', class: 'form-control' %> +
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> + <%= render "devise/shared/error_messages", resource: resource %> + <%= f.hidden_field :reset_password_token %> +
+ <%= f.label :password, t('.new_password'), class: 'form-label' %> + <%= f.password_field :password, autofocus: true, class: 'form-control' %> + <% if @minimum_password_length %> +
<%= t('devise.shared.minimum_password_length', count: @minimum_password_length) %>
+ <% end %> +
+
+ <%= f.label :password_confirmation, t('.confirm_new_password'), class: 'form-label' %> + <%= f.password_field :password_confirmation, autocomplete: 'off', class: 'form-control' %> +
+
+ <%= f.submit t('.change_my_password'), class: 'btn btn-primary' %> +
+ <% end %>
- -
- <%= f.submit t('.change_my_password'), class: 'btn btn-primary' %> + - <% end %> - - <%= render "devise/shared/links" %> -
-
+
+
+
\ No newline at end of file diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index 3cc2dc3..90e74ad 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -1,20 +1,24 @@
-
-

<%= t('.forgot_your_password') %>

- - <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> - <%= render "devise/shared/error_messages", resource: resource %> - -
- <%= f.label :email, class: "form-label" %> - <%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control' %> +
+
+
+

<%= t('.forgot_your_password') %>

- -
- <%= f.submit t('.send_me_reset_password_instructions'), class: 'btn btn-primary' %> +
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> + <%= render "devise/shared/error_messages", resource: resource %> +
+ <%= f.label :email, class: "form-label" %> + <%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control' %> +
+
+ <%= f.submit t('.send_me_reset_password_instructions'), class: 'btn btn-primary' %> +
+ <% end %>
- <% end %> - - <%= render "devise/shared/links" %> -
-
+ +
+
+
\ No newline at end of file diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index b7a67e9..b5ae36d 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -1,50 +1,50 @@
-
-

<%= t('.title', resource: resource.model_name.human) %>

- - <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> - <%= render "devise/shared/error_messages", resource: resource %> - -
- <%= f.label :email, class: 'form-label' %> - <%= f.email_field :email, autocomplete: 'email', class: 'form-control' %> +
+
+
+

<%= t('.title', resource: resource.model_name.human) %>

- - <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> -
<%= t('.currently_waiting_confirmation_for_email', email: resource.unconfirmed_email) %>
- <% end %> - -
- <%= f.label :current_password, class: 'form-label' %> - <%= f.password_field :current_password, autocomplete: 'current-password', class: 'form-control' %> - -
<%= t('.we_need_your_current_password_to_confirm_your_changes') %>
+
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> + <%= render "devise/shared/error_messages", resource: resource %> +
+ <%= f.label :email, class: 'form-label' %> + <%= f.email_field :email, autocomplete: 'email', class: 'form-control' %> +
+ <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> +
<%= t('.currently_waiting_confirmation_for_email', email: resource.unconfirmed_email) %>
+ <% end %> +
+ <%= f.label :current_password, class: 'form-label' %> + <%= f.password_field :current_password, autocomplete: 'current-password', class: 'form-control' %> +
<%= t('.we_need_your_current_password_to_confirm_your_changes') %>
+
+
+

<%= t('devise.passwords.edit.change_your_password') %>

+
<%= t('.leave_blank_if_you_don_t_want_to_change_it') %>
+
+ <%= f.label :password, t('devise.passwords.edit.new_password'), class: 'form-label' %> + <%= f.password_field :password, autocomplete: 'new-password', class: 'form-control' %> + <% if @minimum_password_length %> +
<%= t('devise.shared.minimum_password_length', count: @minimum_password_length) %>
+ <% end %> +
+
+ <%= f.label :password_confirmation, t('devise.passwords.edit.confirm_new_password'), class: 'form-label' %> + <%= f.password_field :password_confirmation, autocomplete: 'new-password', class: 'form-control' %> +
+
+
+ <%= f.submit t('.update'), class: 'btn btn-primary' %> +
+ <% end %> +

+ <%= link_to t('.cancel_my_account'), registration_path(resource_name), data: { confirm: t('.are_you_sure') }, method: :delete %>. +

- -
-

<%= t('devise.passwords.edit.change_your_password') %>

-
<%= t('.leave_blank_if_you_don_t_want_to_change_it') %>
- -
- <%= f.label :password, t('devise.passwords.edit.new_password'), class: 'form-label' %> - <%= f.password_field :password, autocomplete: 'new-password', class: 'form-control' %> - <% if @minimum_password_length %> -
<%= t('devise.shared.minimum_password_length', count: @minimum_password_length) %>
- <% end %> -
-
- <%= f.label :password_confirmation, t('devise.passwords.edit.confirm_new_password'), class: 'form-label' %> - <%= f.password_field :password_confirmation, autocomplete: 'new-password', class: 'form-control' %> -
+ - -
- <%= f.submit t('.update'), class: 'btn btn-primary' %> -
- <% end %> - -

- <%= link_to t('.cancel_my_account'), registration_path(resource_name), data: { confirm: t('.are_you_sure') }, method: :delete %>. -

-
-
+
+
+
\ No newline at end of file diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index 09d7c9b..195837d 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -1,36 +1,37 @@
-
-

<%= t('.sign_up') %>

- - <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> - <%= render "devise/shared/error_messages", resource: resource %> - -
- <%= f.label :email, class: "form-label" %> - <%= f.email_field :email, autofocus: true, autocomplete: "email", class: 'form-control' %> +
+
+
+

<%= t('.sign_up') %>

- -
-
- <%= f.label :password, class: "form-label" %> - <%= f.password_field :password, autocomplete: "new-password", class: 'form-control' %> - - <% if @minimum_password_length %> -
<%= t('devise.shared.minimum_password_length', count: @minimum_password_length) %>
- <% end %> -
- -
- <%= f.label :password_confirmation, class: "form-label" %> - <%= f.password_field :password_confirmation, autocomplete: "new-password", class: 'form-control' %> -
+
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> + <%= render "devise/shared/error_messages", resource: resource %> +
+ <%= f.label :email, class: "form-label" %> + <%= f.email_field :email, autofocus: true, autocomplete: "email", class: 'form-control' %> +
+
+
+ <%= f.label :password, class: "form-label" %> + <%= f.password_field :password, autocomplete: "new-password", class: 'form-control' %> + <% if @minimum_password_length %> +
<%= t('devise.shared.minimum_password_length', count: @minimum_password_length) %>
+ <% end %> +
+
+ <%= f.label :password_confirmation, class: "form-label" %> + <%= f.password_field :password_confirmation, autocomplete: "new-password", class: 'form-control' %> +
+
+
+ <%= f.submit t('.sign_up'), class: 'btn btn-primary' %> +
+ <% end %>
- -
- <%= f.submit t('.sign_up'), class: 'btn btn-primary' %> + - <% end %> - - <%= render "devise/shared/links" %> -
-
+
+
+
\ No newline at end of file diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index a45fae6..05a7efa 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -1,30 +1,33 @@
-
-

<%= t('.sign_in') %>

- - <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> -
- <%= f.label :email, class: "form-label" %> - <%= f.email_field :email, autofocus: true, autocomplete: "email", class: 'form-control' %> +
+
+
+

<%= t('.sign_in') %>

- -
- <%= f.label :password, class: "form-label" %> - <%= f.password_field :password, autocomplete: "current-password", class: 'form-control' %> -
- - <% if devise_mapping.rememberable? %> -
- <%= f.check_box :remember_me, class: 'form-check-input' %> - <%= f.label :remember_me, class: 'form-check-label' %> -
+
+ <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> +
+ <%= f.label :email, class: "form-label" %> + <%= f.email_field :email, autofocus: true, autocomplete: "email", class: 'form-control' %> +
+
+ <%= f.label :password, class: "form-label" %> + <%= f.password_field :password, autocomplete: "current-password", class: 'form-control' %> +
+ <% if devise_mapping.rememberable? %> +
+ <%= f.check_box :remember_me, class: 'form-check-input' %> + <%= f.label :remember_me, class: 'form-check-label' %> +
+ <% end %> +
+ <%= f.submit t('.sign_in'), class: "btn btn-primary" %> +
<% end %> - -
- <%= f.submit t('.sign_in'), class: "btn btn-primary" %>
- <% end %> - - <%= render "devise/shared/links" %> -
-
+ +
+
+
\ No newline at end of file diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb index d11c061..030ac7e 100644 --- a/app/views/devise/shared/_links.html.erb +++ b/app/views/devise/shared/_links.html.erb @@ -1,25 +1,25 @@ <%- if controller_name != 'sessions' %> - <%= link_to t(".sign_in"), new_session_path(resource_name) %>
+ <%= link_to t(".sign_in"), new_session_path(resource_name), class: "card-link" %> <% end %> <%- if devise_mapping.registerable? && controller_name != 'registrations' %> - <%= link_to t(".sign_up"), new_registration_path(resource_name) %>
+ <%= link_to t(".sign_up"), new_registration_path(resource_name), class: "card-link" %> <% end %> <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> - <%= link_to t(".forgot_your_password"), new_password_path(resource_name) %>
+ <%= link_to t(".forgot_your_password"), new_password_path(resource_name), class: "card-link" %> <% end %> <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> - <%= link_to t('.didn_t_receive_confirmation_instructions'), new_confirmation_path(resource_name) %>
+ <%= link_to t('.didn_t_receive_confirmation_instructions'), new_confirmation_path(resource_name), class: "card-link" %> <% 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) %>
+ <%= link_to t('.didn_t_receive_unlock_instructions'), new_unlock_path(resource_name), class: "card-link" %> <% 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), method: :post %>
+ <%= link_to t('.sign_in_with_provider', provider: OmniAuth::Utils.camelize(provider)), omniauth_authorize_path(resource_name, provider), method: :post, class: "card-link" %> <% end %> <% end %> diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb index 4d8232d..9b53e05 100644 --- a/app/views/devise/unlocks/new.html.erb +++ b/app/views/devise/unlocks/new.html.erb @@ -1,20 +1,24 @@
-
-

<%= t('.resend_unlock_instructions') %>

- - <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> - <%= render "devise/shared/error_messages", resource: resource %> - -
- <%= f.label :email, class: "form-label" %> - <%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control' %> +
+
+
+

<%= t('.resend_unlock_instructions') %>

- -
- <%= f.submit t('.resend_unlock_instructions'), class: 'btn btn-primary'%> +
+ <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> + <%= render "devise/shared/error_messages", resource: resource %> +
+ <%= f.label :email, class: "form-label" %> + <%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control' %> +
+
+ <%= f.submit t('.resend_unlock_instructions'), class: 'btn btn-primary'%> +
+ <% end %>
- <% end %> - - <%= render "devise/shared/links" %> -
+ +
+
diff --git a/app/views/partials/_footer.html.erb b/app/views/partials/_footer.html.erb index d0e4bda..29fbf44 100644 --- a/app/views/partials/_footer.html.erb +++ b/app/views/partials/_footer.html.erb @@ -26,6 +26,11 @@ <%= tag.i "", class: "fab fa-lg fa-linkedin" %> +
  • + + <%= tag.i "", class: "fab fa-lg fa-dev" %> + +
  • <%= tag.i "", class: "fas fa-lg fa-code" %> diff --git a/app/views/partials/_match.html.erb b/app/views/partials/_match.html.erb index 1e69f5c..1d06b45 100644 --- a/app/views/partials/_match.html.erb +++ b/app/views/partials/_match.html.erb @@ -1,4 +1,4 @@ -<% intersection = user.gem_names & current_user.gem_names %> +<% intersection = user.gem_list & current_user.gem_list %> <%= render_badge(icon: "fas fa-grin-hearts") do %> <%= intersection.size %> <% end %> \ No newline at end of file diff --git a/app/views/partials/_navbar.html.erb b/app/views/partials/_navbar.html.erb index ffcb9de..0123118 100644 --- a/app/views/partials/_navbar.html.erb +++ b/app/views/partials/_navbar.html.erb @@ -30,6 +30,12 @@ <%= tag.i "", class: "fab fa-github" %> Sign in with Github <% end %>
  • +
  • +
  • + <%= link_to new_user_session_path, class: 'dropdown-item', data: { turbo: false } do %> + <%= tag.i "", class: "fas fa-key" %> Sign in with Password + <% end %> +
  • <% end %> diff --git a/app/views/users/profile.html.erb b/app/views/users/profile.html.erb index 3383715..8f090d8 100644 --- a/app/views/users/profile.html.erb +++ b/app/views/users/profile.html.erb @@ -1,3 +1,5 @@ +<% title ["Profile"] %> + <%= turbo_frame_tag dom_id(current_user, :details) do %> <%= render "/users/details", user: current_user %> <% end %> diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml deleted file mode 100644 index 8922969..0000000 --- a/config/locales/devise.en.yml +++ /dev/null @@ -1,67 +0,0 @@ -# Additional translations at https://github.com/heartcombo/devise/wiki/I18n - -en: - devise: - confirmations: - confirmed: "Your email address has been successfully confirmed." - send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." - send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." - failure: - already_authenticated: "You are already signed in." - inactive: "Your account is not activated yet." - invalid: "Invalid %{authentication_keys} or password." - locked: "Your account is locked." - last_attempt: "You have one more attempt before your account is locked." - not_found_in_database: "Invalid %{authentication_keys} or password." - timeout: "Your session expired. Please sign in again to continue." - unauthenticated: "You need to sign in or sign up before continuing." - unconfirmed: "You have to confirm your email address before continuing." - mailer: - confirmation_instructions: - subject: "Confirmation instructions" - reset_password_instructions: - subject: "Reset password instructions" - unlock_instructions: - subject: "Unlock instructions" - email_changed: - subject: "Email Changed" - password_change: - subject: "Password Changed" - omniauth_callbacks: - failure: "Could not authenticate you from %{kind} because \"%{reason}\"." - success: "Successfully authenticated from %{kind} account." - passwords: - no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." - send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." - send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." - updated: "Your password has been changed successfully. You are now signed in." - updated_not_active: "Your password has been changed successfully." - registrations: - destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." - signed_up: "Welcome! You have signed up successfully." - signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." - signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." - signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." - update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address." - updated: "Your account has been updated successfully." - updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again." - sessions: - signed_in: "Signed in successfully." - signed_out: "Signed out successfully." - already_signed_out: "Signed out successfully." - new: - sign_in: "Sign In" - unlocks: - send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." - send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." - unlocked: "Your account has been unlocked successfully. Please sign in to continue." - errors: - messages: - already_confirmed: "was already confirmed, please try signing in" - confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" - expired: "has expired, please request a new one" - not_found: "not found" - not_locked: "was not locked" - not_saved: - one: "1 error prohibited this %{resource} from being saved:" - other: "%{count} errors prohibited this %{resource} from being saved:" diff --git a/config/locales/devise_invitable.en.yml b/config/locales/devise_invitable.en.yml deleted file mode 100644 index f6bfee4..0000000 --- a/config/locales/devise_invitable.en.yml +++ /dev/null @@ -1,31 +0,0 @@ -en: - devise: - failure: - invited: "You have a pending invitation, accept it to finish creating your account." - invitations: - send_instructions: "An invitation email has been sent to %{email}." - invitation_token_invalid: "The invitation token provided is not valid!" - updated: "Your password was set successfully. You are now signed in." - updated_not_active: "Your password was set successfully." - no_invitations_remaining: "No invitations remaining" - invitation_removed: "Your invitation was removed." - new: - header: "Send invitation" - submit_button: "Send an invitation" - edit: - header: "Set your password" - submit_button: "Set my password" - mailer: - invitation_instructions: - subject: "Invitation instructions" - hello: "Hello %{email}" - someone_invited_you: "Someone has invited you to %{url}, you can accept it through the link below." - accept: "Accept invitation" - accept_until: "This invitation will be due in %{due_date}." - ignore: "If you don't want to accept the invitation, please ignore this email. Your account won't be created until you access the link above and set your password." - time: - formats: - devise: - mailer: - invitation_instructions: - accept_until_format: "%B %d, %Y %I:%M %p" diff --git a/db/migrate/20220111131447_devise_invitable_add_to_users.rb b/db/migrate/20220111131447_devise_invitable_add_to_users.rb deleted file mode 100644 index bf3f453..0000000 --- a/db/migrate/20220111131447_devise_invitable_add_to_users.rb +++ /dev/null @@ -1,22 +0,0 @@ -class DeviseInvitableAddToUsers < ActiveRecord::Migration[7.0] - def up - change_table :users do |t| - t.string :invitation_token - t.datetime :invitation_created_at - t.datetime :invitation_sent_at - t.datetime :invitation_accepted_at - t.integer :invitation_limit - t.references :invited_by, polymorphic: true - t.integer :invitations_count, default: 0 - t.index :invitation_token, unique: true # for invitable - t.index :invited_by_id - end - end - - def down - change_table :users do |t| - t.remove_references :invited_by, polymorphic: true - t.remove :invitations_count, :invitation_limit, :invitation_sent_at, :invitation_accepted_at, :invitation_token, :invitation_created_at - end - end -end diff --git a/db/schema.rb b/db/schema.rb index e960295..7b1eedd 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -100,19 +100,8 @@ t.integer "likes_count", default: 0 t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.string "invitation_token" - t.datetime "invitation_created_at" - t.datetime "invitation_sent_at" - t.datetime "invitation_accepted_at" - t.integer "invitation_limit" - t.string "invited_by_type" - t.bigint "invited_by_id" - t.integer "invitations_count", default: 0 t.integer "identities_count", default: 0 t.index ["email"], name: "index_users_on_email", unique: true - t.index ["invitation_token"], name: "index_users_on_invitation_token", unique: true - t.index ["invited_by_id"], name: "index_users_on_invited_by_id" - t.index ["invited_by_type", "invited_by_id"], name: "index_users_on_invited_by" t.index ["name"], name: "index_users_on_name" t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true t.index ["slug"], name: "index_users_on_slug" diff --git a/db/seeds/02_gems.rb b/db/seeds/02_gems.rb index d6a2615..8622314 100644 --- a/db/seeds/02_gems.rb +++ b/db/seeds/02_gems.rb @@ -27,6 +27,7 @@ "cssbundling-rails", "database_cleaner", "devise", + "devise-i18n", "devise_invitable", "discard", "dotenv", diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index 653c668..2a74480 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -23,22 +23,11 @@ # likes_count :integer default("0") # created_at :datetime not null # updated_at :datetime not null -# invitation_token :string -# invitation_created_at :datetime -# invitation_sent_at :datetime -# invitation_accepted_at :datetime -# invitation_limit :integer -# invited_by_type :string -# invited_by_id :integer -# invitations_count :integer default("0") # identities_count :integer default("0") # # Indexes # # index_users_on_email (email) UNIQUE -# index_users_on_invitation_token (invitation_token) UNIQUE -# index_users_on_invited_by (invited_by_type,invited_by_id) -# index_users_on_invited_by_id (invited_by_id) # index_users_on_name (name) # index_users_on_reset_password_token (reset_password_token) UNIQUE # index_users_on_slug (slug) diff --git a/test/models/user_test.rb b/test/models/user_test.rb index a527565..1d5e329 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -23,22 +23,11 @@ # likes_count :integer default("0") # created_at :datetime not null # updated_at :datetime not null -# invitation_token :string -# invitation_created_at :datetime -# invitation_sent_at :datetime -# invitation_accepted_at :datetime -# invitation_limit :integer -# invited_by_type :string -# invited_by_id :integer -# invitations_count :integer default("0") # identities_count :integer default("0") # # Indexes # # index_users_on_email (email) UNIQUE -# index_users_on_invitation_token (invitation_token) UNIQUE -# index_users_on_invited_by (invited_by_type,invited_by_id) -# index_users_on_invited_by_id (invited_by_id) # index_users_on_name (name) # index_users_on_reset_password_token (reset_password_token) UNIQUE # index_users_on_slug (slug)