demarches-normaliennes/app/controllers/password_complexity_controller.rb

19 lines
463 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class PasswordComplexityController < ApplicationController
def show
2024-09-17 10:59:58 +02:00
@length = password_param.to_s.length
@score = ZxcvbnService.complexity(password_param)
@min_length = PASSWORD_MIN_LENGTH
@min_complexity = PASSWORD_COMPLEXITY_FOR_ADMIN
end
private
def password_param
params
.transform_keys! { |k| params[k].try(:has_key?, :password) ? 'resource' : k }
.dig(:resource, :password)
end
end