login+registration user, CFormModel or CActiveRecord?

I want to create login and registration forms + User model

Login form should:

  1. validate password and login not empty

  2. validate that they are match the regular expressions

  3. if 1 and 2 are true pass it to UserIdentity for final login, and redirect to member zone

Registration form should:

  1. validate password login and email not empty

  2. validate email is valid

  3. validate that they are match the regular expressions

  4. validate the captcha

  5. validate that email and username are unique with http://www.yiiframework.com/doc/api/1.1/CUniqueValidator or some custom…

And of course I need User extends CActiveRecord , cause I need some user instance

The options I see:

  1. create LoginForm extends CFormModel + RegisterForm extends CFormModel + User extends CActiveRecord

  2. create UserForm that extends CFormModel nd work with registration and login by scenario with same model + User that extends CActiveRecord

  3. Create only User extends CActiveRecord , and provide it with rules by scenario

What you suggest me?

Actually I like the most - options 2 and 3 , but 2 will make me duplicate a lot of code (mostly the rules)

What I don’t like in CFormModel with the unique validation rule: it requires to set

getDbConnection + tableName , so it is almost ActiveRecord ::)

the downside I see with 3 is - too much scenario in User model will make it a mess…

Also User is an object, and actually it is strange to create new User(‘registration’) just to validate the form etc.

up