mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-25 19:26:22 +00:00
26 lines
471 B
Ruby
26 lines
471 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
# Almacena una contraseña
|
||
|
class MetadataPassword < MetadataString
|
||
|
# Las contraseñas no son indexables
|
||
|
#
|
||
|
# @return [boolean]
|
||
|
def indexable?
|
||
|
false
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
alias_method :original_sanitize, :sanitize
|
||
|
|
||
|
# Sanitizar la string y generar un hash Bcrypt
|
||
|
#
|
||
|
# @param :string [String]
|
||
|
# @return [String]
|
||
|
def sanitize(string)
|
||
|
string = original_sanitize string
|
||
|
|
||
|
::BCrypt::Password.create(string).to_s
|
||
|
end
|
||
|
end
|