adva 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e28316c3b91bb83ff5061ace18dcd8c7e55a04d7ec14a119fa0203bb3e785e9
4
- data.tar.gz: 1137ac1055d6de31aad3cd754c3e031eab6f217c94c9415b675fe6e4b41eaa67
3
+ metadata.gz: e231f9d15f7a84664b796cdbe2902c42eefb3f788ac16f1c42905f66c54fba16
4
+ data.tar.gz: f9ba6b4aa6b9b60693afb800bb93ea2e799bcae69ae6a10c9ca0d5c1e0812f9a
5
5
  SHA512:
6
- metadata.gz: e2919540891969b3f9f580a2cc6aee71c816b31bb5ad5285d6c91bb40668150fd258e3d466c97b9b2763d9f083730b137e99bb77f26896ca592e5fb6a06a1132
7
- data.tar.gz: 5b8b2b5d0c6439c6605081825f0716bb3ad4e3560f3ec6bbbb0db9bc3ec5a8c5132866d4ee2512173b1e22da2b1f918e8a1249fa7b362dd89c991424ded2aaa2
6
+ metadata.gz: 7e2bb457997618616e54e7db02da08ea7edeb8590fa0a92bae39e3acddc753e81f74489a3ace9db1d501b5caa020dfcaab219f877fb0698bf3a017c35a38ea9d
7
+ data.tar.gz: e39c522d576e0f6a027255b6bbfc8617eba939ae70bfc43f87fdd065a63bc0168a47642d086b80d44db5381a7538fec939b3507e45f63374d9b8433e9bf61963
data/app/models/user.rb CHANGED
@@ -18,14 +18,15 @@ class User < ActiveRecord::Base
18
18
  :with => /(\A(\s*)\Z)|(\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z)/i
19
19
 
20
20
  validates_presence_of :password, :if => :password_required?
21
- validates_length_of :password, :within => 4..40, :if => :password_required?
21
+ validates_length_of :password, :within => 12..128, :if => :password_required?
22
+ validate :password_complexity, :if => :password_required?
22
23
 
23
24
  class << self
24
25
  def authenticate(credentials)
25
26
  return false unless user = User.find_by_email(credentials[:email])
26
27
  user.authenticate(credentials[:password]) ? user : false
27
28
  end
28
-
29
+
29
30
  def anonymous(attributes = {}) # FIXME rename to build_anonymous
30
31
  attributes[:anonymous] = true
31
32
  new attributes
@@ -102,4 +103,18 @@ class User < ActiveRecord::Base
102
103
  def password_required?
103
104
  !anonymous? && (password_hash.nil? || password.present?)
104
105
  end
106
+
107
+ def password_complexity
108
+ return unless password.present?
109
+
110
+ character_types = 0
111
+ character_types += 1 if password.match?(/[a-z]/) # lowercase
112
+ character_types += 1 if password.match?(/[A-Z]/) # uppercase
113
+ character_types += 1 if password.match?(/[0-9]/) # numbers
114
+ character_types += 1 if password.match?(/[!@#$%^&*()_+\-=\[\]{}|;:,.<>?]/) # symbols
115
+
116
+ if character_types < 3
117
+ errors.add(:password, 'must contain at least 3 of the following: lowercase letters, uppercase letters, numbers, or special characters')
118
+ end
119
+ end
105
120
  end
data/lib/adva/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Adva
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adva
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-05 00:00:00.000000000 Z
11
+ date: 2025-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: will_paginate
@@ -1084,7 +1084,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1084
1084
  - !ruby/object:Gem::Version
1085
1085
  version: '0'
1086
1086
  requirements: []
1087
- rubygems_version: 3.2.32
1087
+ rubygems_version: 3.5.11
1088
1088
  signing_key:
1089
1089
  specification_version: 4
1090
1090
  summary: cutting edge cms, blog, wiki, forum