aboutsummaryrefslogtreecommitdiff
path: root/src/operations/mixins/password_validations.cr
blob: c56b9750c8c8b34d8fd622841fb2231c6c40c539 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
module PasswordValidations
  macro included
    before_save run_password_validations
  end

  private def run_password_validations
    validate_required password, password_confirmation
    validate_confirmation_of password, with: password_confirmation
    # 72 is a limitation of BCrypt
    validate_size_of password, min: 6, max: 72
  end
end