aboutsummaryrefslogtreecommitdiff
path: root/src/operations/sign_up_user.cr
blob: 8c46fadc7ccc96ca09a2e87a877774c33d96a3ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class SignUpUser < User::SaveOperation
  param_key :user
  # Change password validations in src/operations/mixins/password_validations.cr
  include PasswordValidations

  permit_columns email
  attribute password : String
  attribute password_confirmation : String

  before_save do
    validate_uniqueness_of email
    Authentic.copy_and_encrypt(password, to: encrypted_password) if password.valid?
  end
end