Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Enforcing Password Policies

Questions related to using nuBuilder Forte.
Locked
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Enforcing Password Policies

Unread post by marc »

No matter how secure you make a user’s password initially, the user will eventually choose his own password. (choosing a one character password is possible !)
How to set account policies that define a secure password?
What possibilities does nuBuilder offer? Esp. when used in a company with sensitive data it's essential (data protection)
Can you tell me about your experience?

e.g.

Maximum Password Age
Passwords must have at least 8 characters.
Passwords can’t contain the user name or parts of the user’s full name, such as his first name.
Passwords must use at least three of the four available character types: lowercase letters, uppercase.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Enforcing Password Policies

Unread post by admin »

marc,

Sorry, but you can't do this in nuBuilder.

Steven
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Enforcing Password Policies

Unread post by toms »

Steven,

nuBuilder could easily implement such a feature in a very generic way (and it would be optional, up to the user to implement it or not). So every user could implement their own password policy check.

And I agree with marc, this would be a very important feature to improve nuBuilder's security.

All you would have to do is add 7 rows to BS of the nuPassword form to make such a feature possible.
bs_password.PNG
This would check for the existence of a function (let's call it nuCheckPasswordPolicy() ).

-> If present, the saving just succeeds if the check returns true.

-> If there is no such function, the saving would work as it is now.


Then the user can create his own nuCheckPasswordPolicy() procedure.
Example:

Code: Select all

function nuCheckPasswordPolicy() {

$oldpw	= '#old_password#';
$newpw	= '#new_password#';

$passwordErr = "";

    if (strlen($newpw) < 8) {
        $passwordErr .= "Your Password Must Contain At Least 8 Characters!<br>";
    }
    if (!preg_match("#[0-9]+#",$newpw)) {
        $passwordErr .= "Your Password Must Contain At Least 1 Number!<br>";
    }
    if (!preg_match("#[A-Z]+#",$newpw)) {
        $passwordErr .= "Your Password Must Contain At Least 1 Capital Letter!<br>";
    }
    if(!preg_match("#[a-z]+#",$newpw)) {
        $passwordErr .= "Your Password Must Contain At Least 1 Lowercase Letter!<br>";
    }

if (strlen($passwordErr) > 0) {
	nuDisplayError ($passwordErr) ;
	return false;
} else
{
	return true;
}
}

$check = nuCheckPasswordPolicy();
You do not have the required permissions to view the files attached to this post.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Enforcing Password Policies

Unread post by admin »

.
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Re: Enforcing Password Policies

Unread post by marc »

toms, good idea.

@admin: is it possible to make this change?
toms wrote: All you would have to do is add 7 rows to BS of the nuPassword form to make such a feature possible.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Enforcing Password Policies

Unread post by admin »

Guys,

I have added that now in the Before Save.

It's in Github now.

You'll need to get it and run Update.

Please let me know if it works and then I'll update the wiki and include toms sample procedure.

Steven
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Enforcing Password Policies

Unread post by toms »

It works all fine here and I've updated my sample procedure:

Code: Select all

function nuCheckPasswordPolicy() {

    $oldpw    = '#old_password#';
    $newpw    = '#new_password#';
    
    $passwordErr = "";
    
    if ($newpw === $oldpw) {
        $passwordErr .= "The provided New Password cannot be the same as the Current Password!<br>";
    }    
    if (strlen($newpw) < 8) {
        $passwordErr .= "Your Password must contain at least 8 Characters!<br>";
    }
    if (!preg_match("#[0-9]+#",$newpw)) {
        $passwordErr .= "Your Password must contain at least 1 Number!<br>";
    }
    if (!preg_match("#[A-Z]+#",$newpw)) {
        $passwordErr .= "Your Password must contain at least 1 Capital Letter!<br>";
    }
    if(!preg_match("#[a-z]+#",$newpw)) {
        $passwordErr .= "Your Password must contain at least 1 Lowercase Letter!<br>";
    }
    if(!preg_match('/[\'\/~`\!@#\$%\^&\*\(\)_\-\+=\{\}\[\]\|;:"\<\>,\.\?\\\]/', $newpw)) {
        $passwordErr .= "Your Password must contain at least 1 Special Character!<br>";
    }    

    if (strlen($passwordErr) > 0) {
        nuDisplayError ($passwordErr) ;
        return false;
    } else
    {
        return true;
    }
}

$check = nuCheckPasswordPolicy();
You do not have the required permissions to view the files attached to this post.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Enforcing Password Policies

Unread post by admin »

toms,

Thanks for that.

This has now been added to the wiki.

https://wiki.nubuilder.cloud/ ... d_Policies


Steven
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Re: Enforcing Password Policies

Unread post by marc »

Thank you both, works for me too
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Enforcing Password Policies

Unread post by admin »

.
Locked