Welcome Guest, Not a member yet? Register   Sign In
Question new form validation rule
#6

(10-22-2018, 02:35 AM)ciadmin Wrote: Given the external HIBP service, this feels more like an addin than something that would be part of the CI4 core.
That appears to be the way the original package you link to has been built.
I am curious to see what others think.

I feel that Laravel users are more used to using packages, and well I don't feel the same for CodeIgniter (just my opinion).
Still open for feedback, I will wait a little longer before I start on the PR.

(10-22-2018, 06:23 AM)visualsol Wrote: Glenn,
Looking at this package, it seems like while it is labelled Laravel, it is almost framework agnostic, that is you should be able to make an agnostic variation of it and use it in Codeigniter 4 with only minor adjustment.  For example, once you removed the Laravel references, if you were using the CI4 Starter I recently built, you could put the call in the Secure Controller.

Steps:
1) composer require valorin/pwned-validator (replace this with your version of it)
2) use the Valorin\Pwned\Pwned Validation Rule Object
a) in controller Secure.php add after line 3: use \Valorin\Pwned\Pwned
b) at line 48 add the call:
$pwnedvalidtn = new \Valorin\Pwned\Pwned(100);
$valid = $pwnedvalidtn->validate('password', $password);
if (!valid)  {return error message}

Or you could make use of the good ole fashion validation rules in a similar manner.

Bob

PS I found  this https://gitlab.com/ExeQue/PHP-HIBP generic package just after I wrote this.

First the package you linked only contains search breaches and search email in breaches, what I am suggesting is a password check.
Second I am suggesting a new form validation rule so that a user can easily implement it in their controller and when failed the framework will handle the error flow. No custom implementation needed in their code.

What I have in mind is easy usability for users, they add the param to their rules and it will check without any extra code needed.
Reply


Messages In This Thread
Question new form validation rule - by glennm - 10-22-2018, 12:42 AM
RE: Question new form validation rule - by glennm - 10-22-2018, 01:31 AM
RE: Question new form validation rule - by glennm - 10-22-2018, 12:42 PM
RE: Question new form validation rule - by glennm - 10-22-2018, 02:00 PM
RE: Question new form validation rule - by glennm - 10-23-2018, 11:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB