diff options
author | Logan Fick <logaldeveloper@protonmail.com> | 2017-10-18 17:30:42 -0400 |
---|---|---|
committer | Logan Fick <logaldeveloper@protonmail.com> | 2017-10-18 17:30:42 -0400 |
commit | 5ab615e18f093e7654bae3c628bd3349532fdfd5 (patch) | |
tree | ecdeeee9c66e28ffe134060ee76e201150217fac | |
parent | d2d64d20f0437b5dcd3439292ab913e2e1990da2 (diff) |
Added public key validation.
-rw-r--r-- | app/models/user.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 14364ed..4f682c6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -22,6 +22,8 @@ class User < ActiveRecord::Base validates :email, uniqueness: {case_sensitive: false}, format: {with: /\A.+@(.+\..{2,}|\[(IPv6)?[0-9a-f:.]+\])\z/i, message: "That doesn't look like an email address."} validates :ign, uniqueness: {case_sensitive: false}, format: {with: /\A[a-z\d_]+\z/i, message: "Username is invalid (a-z, 0-9, _)."} + validates :public_key, format: {with: /\A(-----BEGIN PGP PUBLIC KEY BLOCK-----((.|\n)*?)-----END PGP PUBLIC KEY BLOCK-----)?\z/i, message: "That doesn't look like a PGP formatted public key."} + has_many :blogposts has_many :comments |