adva 0.3.1 → 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: 8c3997901ea2461824f4a188bd318edefc574738532902269138ccc55e7aecdd
4
- data.tar.gz: 7cf29ab88678f8063368d10779241dc1b3aebb078ca986a64caf9d96c93bd853
3
+ metadata.gz: e231f9d15f7a84664b796cdbe2902c42eefb3f788ac16f1c42905f66c54fba16
4
+ data.tar.gz: f9ba6b4aa6b9b60693afb800bb93ea2e799bcae69ae6a10c9ca0d5c1e0812f9a
5
5
  SHA512:
6
- metadata.gz: b69b28b4b18c70a8cf8355faabb5e44eaa4c2d0ff31f1c441a6e26021a506dfe09ff64f9aabde37ac34da2e2976ea98dfd4909dd50f434da56f6535ae4e69419
7
- data.tar.gz: 5d849f488ff6212b5701ee19bf77d4cf22948e69ceb2eb8007585d310fbc082cd2b558018c45d1aefd86e327953da955a0d791818933b372b63adffb050b34bf
6
+ metadata.gz: 7e2bb457997618616e54e7db02da08ea7edeb8590fa0a92bae39e3acddc753e81f74489a3ace9db1d501b5caa020dfcaab219f877fb0698bf3a017c35a38ea9d
7
+ data.tar.gz: e39c522d576e0f6a027255b6bbfc8617eba939ae70bfc43f87fdd065a63bc0168a47642d086b80d44db5381a7538fec939b3507e45f63374d9b8433e9bf61963
@@ -289,7 +289,7 @@ class Table extends Base {
289
289
  this.trs = Array.from(this.table.querySelectorAll('tr'))
290
290
  this.children = this.trs.map(tr => {
291
291
  if(this.table_tree.level(tr) === 0) {
292
- return new Node(this.table_tree, this, tr, this.table_tree.level(tr))
292
+ return new TableNode(this.table_tree, this, tr, this.table_tree.level(tr))
293
293
  }
294
294
  }).filter(e => e)
295
295
  }
@@ -392,7 +392,7 @@ class Table extends Base {
392
392
  }
393
393
  }
394
394
 
395
- class Node extends Base {
395
+ class TableNode extends Base {
396
396
  constructor(table_tree, parent, element, level) {
397
397
  super()
398
398
  this.table_tree = table_tree
@@ -403,7 +403,7 @@ class Node extends Base {
403
403
  this.children = this.find_children().map(child => {
404
404
  var level = this.table_tree.level(child)
405
405
  if(level == this.level + 1) {
406
- return new Node(this.table_tree, this, child, level)
406
+ return new TableNode(this.table_tree, this, child, level)
407
407
  }
408
408
  }).filter(e => e)
409
409
  }
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.1"
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.1
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