CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Password Encryption Solution

Print topic Send  topic

Author Message
MichaelMcDonald

Posts: 640
Posted: 07/03/2009, 1:34 PM

Hi,

I have put this together and it works (the code in index.php) is from another post in this forum.


First, for the update form - I use the record builder to create form with temporary password field.
Then I use custom update type SQL.

The code is:
Update users set user_password=(md5('{npass}')) WHERE user_id = {user_id};

I have a validation rule set under The Properties Inspector 'Data' tab for the field control to ensure matching passwords:

($this->npass->GetValue()) == ($this->cpass->GetValue())

Second, I have a Properties Inspector 'Events' tab Regular Expression Validation:
(You can enter a Regular Expression Validation in the form on validate event):

^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8}$

This is the resulting generated code for that:

global $CCSLocales;
if (CCStrLen($Container->npass->GetText()) && !preg_match("/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8}\$/", $Container->npass->GetText()))
{
$Container->npass->Errors->addError("Password must be 8 characters and contain at least one uppercase, one lowercase and one numeric digit");
}



Third, in index.php (this is to check for md5 when logging in):

global $CCSLocales;
global $Redirect;
$Container->password->SetValue(md5($Container->password->GetValue()));
if ( !CCLoginUser( $Container->login->Value, $Container->password->Value)) {
$Container->Errors->addError($CCSLocales->GetText("CCS_LoginError"));
$Container->password->SetValue("");
$Login_Button_DoLogin_OnClick = 0;
} else {
global $Redirect;
$Redirect = CCGetParam("ret_link", $Redirect);
$Login_Button_DoLogin_OnClick = 1;
}

_________________
Central Coast, NSW, Australia.

View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.