Fixes on fields for show errors properly

This commit is contained in:
Antonio de la Rosa 2015-08-27 17:25:07 +02:00
parent f0860b413a
commit f3b4b4e454
5 changed files with 35 additions and 8 deletions

View file

@ -50,7 +50,7 @@ class EmailField extends PhangoField {
else
{
$this->std_error.='Email format error';
$this->std_error='Email format error';
return '';

View file

@ -35,9 +35,13 @@ class PasswordField extends CharField {
}
/*
$token_pass=Utils::generate_random_password();
$hash_password=$token_pass.'_'.sha1($token_pass.'_'.$value);
*/
$hash_password=password_hash($value, PASSWORD_DEFAULT);
return $hash_password;
@ -50,8 +54,8 @@ class PasswordField extends CharField {
//If pass have _ check if work fine...
$token_pass=preg_replace('/(.*)[_].*/', '$1', $hash_password_check);
//$token_pass=preg_replace('/(.*)[_].*/', '$1', $hash_password_check);
/*
$hash_password=$token_pass.'_'.sha1($token_pass.'_'.$value);
if($hash_password==$hash_password_check)
@ -59,6 +63,13 @@ class PasswordField extends CharField {
return true;
}*/
if(password_verify($value, $hash_password_check))
{
return true;
}
return false;

View file

@ -22,7 +22,7 @@ class PrimaryField extends PhangoField {
* Initial label for the field. The label is used for create forms from a PhangoField.
*/
public $label="";
public $label="#ID";
/**
* Boolean value that is used for check if the field is required for fill a row in the db model.