Skip to content

Commit a6a3976

Browse files
committed
Disable password validations
Password validations are now performed by Devise.
1 parent 8638caa commit a6a3976

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

src/api/app/models/user.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ class User < ApplicationRecord
1515
attribute :color_theme, :integer
1616
enum :color_theme, { 'system' => 0, 'light' => 1, 'dark' => 2 }
1717

18-
# disable validations because there can be users which don't have a bcrypt
19-
# password yet. this is for backwards compatibility
20-
has_secure_password validations: false
21-
2218
has_many :watched_items, dependent: :destroy
2319
has_many :groups_users, inverse_of: :user
2420
has_many :roles_users, inverse_of: :user
@@ -125,8 +121,6 @@ class User < ApplicationRecord
125121
message: 'must be a valid email address',
126122
allow_blank: true }
127123

128-
# we disabled has_secure_password's validations. therefore we need to do manual validations
129-
validate :password_validation
130124
validates :password, length: { minimum: 6, maximum: ActiveModel::SecurePassword::MAX_PASSWORD_LENGTH_ALLOWED }, allow_nil: true
131125
validates :password, confirmation: true, allow_blank: true
132126
validates :biography, length: { maximum: MAX_BIOGRAPHY_LENGTH_ALLOWED }
@@ -856,12 +850,6 @@ def self.nobody
856850
end
857851
private_class_method :nobody
858852

859-
def password_validation
860-
return if password_digest || deprecated_password
861-
862-
errors.add(:password, 'can\'t be blank')
863-
end
864-
865853
# FIXME: This should be a policy
866854
def can_modify_project_internal(project, ignore_lock)
867855
# The ordering is important because of the lock status check

0 commit comments

Comments
 (0)