aboutsummaryrefslogtreecommitdiff
path: root/src/operations/sign_up_user.cr
diff options
context:
space:
mode:
Diffstat (limited to 'src/operations/sign_up_user.cr')
-rw-r--r--src/operations/sign_up_user.cr14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/operations/sign_up_user.cr b/src/operations/sign_up_user.cr
new file mode 100644
index 0000000..8c46fad
--- /dev/null
+++ b/src/operations/sign_up_user.cr
@@ -0,0 +1,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