So I’m relatively new to Yii, but enjoy it thus far. I have read several articles/posts on how to implement registration, but none of them seem to answer my question - what’s the best way to do it?
For example, I have two tables - m_password and m_person:
[indent]
m_person:
personID
firstName
lastName
m_password:
id
person_id
hashedPassword
salt
[/indent]
I also have a model for Password and Person. My planned implementation was to create a form (class RegisterForm extends CFormModel) as well as an actionRegister method in the SiteController.
Within the SiteController, I was going to pass both models to the view:
public function actionRegister() {
$person = new Person;
$password = new Password;
...
$this->render('register', array('person'=>$person, 'password'=>$password));
}
Here are some question I had about this approach:
1.) Since the Person model is related to the Password via a HAS_ONE relationship, do I even need to create a PasswordController? Is it bad practice to access the password hash exclusively through the PersonController?
2.) Is the SiteController the best place to put generic forms such as Registration and Login?
3.) Is there anything flawed about my intended implementation?
Thanks in advance!