Jump to content
Larry Ullman's Book Forums

Solid

Members
  • Posts

    6
  • Joined

  • Last visited

Solid's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Nah, for now im just trying to post the data manually in a form in the validation-page. Its the update-code thats not working... I dident explain that well enough in the first post, my bad.
  2. Hi all. Im trying go abit beyond the chapters of the yii-book, and im struggeling with the update of a database. I cant seem to figure out how i update an existing row. So im trying to build a e-mail verification, a user registers and gets an email with a link to myproject.com/verify?id=ID&verificationcode=VERIFICATIONCODE, and the verifypage picks it up and runs my actionVerify() method: public function actionVerify() { $model=User::model()->findByPk($_POST['id']); $model->attributes=$_POST['Verify']; if($model->validate()) { Yii::app()->user->setFlash('validated','<h2>Your E-mail is validated!</h2><p>You can now log in using the form below.</p>'); $model->save(); $this->redirect(Yii::app()->homeUrl/login); } } I've tried for a few hours now, starting of with using $model = new User, that ofcourse generates an error as you cant update an existing row with the creation of a new object. The code i have pasted over here generates the following error: Undefined index: id So im kinda stuck here, and im sure the solution is close to something i've tried. I have googled this alot, but the lack of well-explained articles kills me. I just dont have the understandment of yii/oop to use the manual or short articles just yet. Any help is appriciated, thanks in advance.
  3. Thx, nice fix. I was struggeling a bit at first, but then i figured out what i did wrong. You have to remember the / in front of register when you add it to the menu, or it will go to /site/register and fail. You can also add: '/'=>'/site/index' and set the home-link to just /. Thank you Simon
  4. Agree Ziggi and oliver, thats the hardest thing for me to grasp aswell. Good suggestion.
  5. Hi all! I've followed the authentication tutorials here, but i wonder if Yii has a workaround for using both cookies and sessions for authentication. I want to allow use of the "remember me" button, but still save the roles, emails and such in sessions for security. Acording to the yii-manual the CBaseUserIdentity::setState will use cookies if its enabled, and use sessions if its set to false. Im thinking about a solution where you save a sha1($username $password) in the cookie, and make a method that gathers the other information in a auto-load-if-logged-in sort of way, but im not sure how secure it is, and if it might put to much unnessesary stress on the DB-server. Anyone made anything like that work, or has any idea? Edit: tags turned out wrong, cant seem to edit them. authentication spelled wrong, and also stuck together with cookies tag.
  6. Have you seen this? http://www.larryullm...-yii-framework/ Allso a forum-topic about it here.. http://www.larryullm...in-accessrules/ In short its about assigning roles to the users, and allowing them access trough the roles. If i dident missunderstand your question, that would help you getting use of the accessRules.
×
×
  • Create New...