2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-08-31 18:14:32 +02:00
|
|
|
class PasswordComplexityController < ApplicationController
|
|
|
|
def show
|
2024-09-09 15:40:54 +02:00
|
|
|
@score, @length = ZxcvbnService.new(password_param).complexity
|
2021-08-31 18:14:32 +02:00
|
|
|
@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
|