Reputation: 2557
I use symfony 1.4 with sfGuard with Propel, and considering that this is my first symfony experience, I'm still a total noob with some part of the architecture.
I was asked to create some webservices, one of this shall be taking user (email) and password and print out a json string feedback as result.
I don't have a clue about how to perform such a task with sfGuard, so if anybody has an example it'd be appreciated.
I think that the algorithm should be sha1, because in the sf_guard_user table I found rows like
id username algorithm salt password created_at last_login is_active is_super_admin
4 [email protected] sha1 623de866b49c696b452e0d12b55895c8 dcbe87a60a769b9e3b5f0988141b824fa5206235 2011-12-06 02:32:43 2011-12-27 15:49:41 1 0
Upvotes: 0
Views: 653
Reputation: 2557
Ok, I've found a dirty trick, but it works.
I can fake a login form submission and sitck to the usual login patter, which it becomes something like:
$request->setParameter('signin', array(
'username' =>$request->getParameter("username"),
'password' =>$request->getParameter("password"),
));
$form = new BeetleLoginForm();
$form->bind($request->getParameter('signin'));
if ($form->isValid()) {
$values = $form->getValues();
$this->getUser()->signin($values['user'], false);
$resp['return'] = "YES";
$resp['message'] = "You have successfully logged in";
return $this->renderText(json_encode($resp));
}
I hope that this could help somebody stuck in the same limbo.
Upvotes: 0
Reputation: 1696
Just have a look at sfGuardValidatorUser
class.
Basically it's something like this:
checkPassword
public method from the sfGuardUser
class (default is something like sha1(db_salt.submitted_password) == db_password
)Upvotes: 1