Joined March 2017
·

bobf

Posted to Devise password generator over 1 year ago

This works in some (most ?) cases but bear in mind that this ignores any password complexity/validation rules that may be in place. My preference is to repeatedly attempt to generate a password from a set of predefined characters (e.g. alphanumeric, symbols) using Devse.password_length.min and Devise.password_regex.

Just be sure to set some limit on how many attempts it will make to avoid infinite loops if the seed character set is insufficient to satisfy the complexity requirements.

Achievements
1 Karma
0 Total ProTip Views