facebook error while saving User model
First when trying to integrate with facebook I got errors for missing User mode properties:
- fname
- lname
- gender
- birthday
- acc_status
After I added them to the model and to the DB I got the following error:
Error, while saving User model:
array (
'username' =>
array (
0 => 'Username cannot be blank.',
),
'password' =>
array (
0 => 'Password cannot be blank.',
),
)
What should I do?
you shouldn't use that properties. That was only for demo. You should use only those, you need. HOAuthAction::attributes property used to automatically map your model's properties to the info, that is returned by social network.
about validation error:
does username used for login? can you make it not required for registering with hoauth?
if yes, than you can create separate scenario for sign-in with hoauth (you can specify this scenario in HOAuthAction::scenario) to make fields password and username not required for social network authorization. In last Yii version you can use 'except' rule property, e.g.
function rules() {
return array(
array('password, username', 'required', 'except' => 'hoauth'), // hoauth is you scenario name
...
);
}