I've had to add :registrationable to allow editing of passwords etc

Althouth I need to remove the routes for sign_up.
This commit is contained in:
Jez Caudle 2024-05-09 13:36:53 +01:00
parent 1ac47de706
commit 2594df3086
4 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,5 @@
class User < ApplicationRecord class User < ApplicationRecord
# Include default devise modules. Others available are: # Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :recoverable, :rememberable, :validatable, :lockable, :timeoutable, :trackable devise :database_authenticatable, :recoverable, :rememberable, :validatable, :lockable, :timeoutable, :trackable, :registerable
end end

View File

@ -2,7 +2,7 @@
<%= link_to "Log in", new_session_path(resource_name) %><br /> <%= link_to "Log in", new_session_path(resource_name) %><br />
<% end %> <% end %>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %> <%- if devise_mapping.registerable? && controller_name != 'registrations' && false %>
<%= link_to "Sign up", new_registration_path(resource_name) %><br /> <%= link_to "Sign up", new_registration_path(resource_name) %><br />
<% end %> <% end %>

View File

@ -1,3 +1,5 @@
<% if user_signed_in? %><%= link_to current_user.email, edit_user_password_path %><% end %>
<h1>Domains <%= link_to "Add new domain",new_domain_path %> </h1> <h1>Domains <%= link_to "Add new domain",new_domain_path %> </h1>
<div id="domains"> <div id="domains">

View File

@ -178,7 +178,7 @@ Devise.setup do |config|
# ==> Configuration for :validatable # ==> Configuration for :validatable
# Range for password length. # Range for password length.
config.password_length = 6..128 config.password_length = 16..128
# Email regex used to validate email formats. It simply asserts that # Email regex used to validate email formats. It simply asserts that
# one (and only one) @ exists in the given string. This is mainly # one (and only one) @ exists in the given string. This is mainly
@ -208,7 +208,7 @@ Devise.setup do |config|
# Number of authentication tries before locking an account if lock_strategy # Number of authentication tries before locking an account if lock_strategy
# is failed attempts. # is failed attempts.
# config.maximum_attempts = 20 config.maximum_attempts = 3
# Time interval to unlock the account if :time is enabled as unlock_strategy. # Time interval to unlock the account if :time is enabled as unlock_strategy.
# config.unlock_in = 1.hour # config.unlock_in = 1.hour