Password Hashing with Phpass [SOLVED]

A place for users and developers of the Xataface to discuss and receive support.

Password Hashing with Phpass [SOLVED]

Postby Cyanto » Thu Jul 21, 2011 12:29 am

Hi to everybody,

I'm writing an application with Xataface and I need to change the encryption method by implementing Phpass.
I've no problem with password serialization. I had wrote a delegate class for my users table:

Code: Select all
function password__serialize(&$record){
      $hash_cost_log2 = 64;
      $hash_portable = FALSE;
      $password = $record->val('password');
      $hasher = new PasswordHash($hash_cost_log2, $hash_portable);
      $hash = $hasher->HashPassword($password);
      unset($hasher);
      return $hash;
}


My problem is at login. I don't know how to implement Phpass to work at login.
Do I need to write a function in app delegate class?
Do I need to use a trigger?

Can anyone help me?

I've already searched in wiki, documentation and forum without success.

Thanks
Cyanto
Last edited by Cyanto on Fri Jul 22, 2011 12:48 am, edited 1 time in total.
Cyanto
 
Posts: 2
Joined: Thu Jul 21, 2011 12:15 am

Re: Password Hashing with Phpass

Postby shannah » Thu Jul 21, 2011 9:39 am

The fieldname__serialize() method takes the value to be serialized as a parameter rather than the record. Here is the signature:
Code: Select all
/**
    * @brief Serializes a field value to prepare it for insertion into an SQL query.
    *
    * @param mixed $value The field value that is to be serialized.
    * @return string The serialized value that is ready to be placed in an SQL query (though hasn't been escaped for quotes).
    *
    * @since 0.5
    *
    * @see Dataface_Serializer::serialize()
    *
    */
   function fieldname__serialize($value);


Not sure why your method was working at all. It should have thrown a fatal error when you tried to call the val() method on $record.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Password Hashing with Phpass

Postby Cyanto » Fri Jul 22, 2011 12:34 am

shannah wrote:The fieldname__serialize() method takes the value to be serialized as a parameter rather than the record.


I've fixed my error. Password field serialization finally works fine.

I'm writing a Custom Authentication plugin to implement Phpass.

Thanks Steve!!
Cyanto
 
Posts: 2
Joined: Thu Jul 21, 2011 12:15 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 25 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved