Yii Framework Forum: Bug Captcha - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Bug Captcha BUG captcha Rate Topic: -----

#1 User is offline   xicond 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 32
  • Joined: 06-October 12

Posted 01 March 2013 - 04:59 AM

Captcha buggy while the testLimit 1 and run :

if($model->validate() && $model->save()){
$message = "Terima kasih atas kiriman info Resto/Rumah Makan Anda, Kami akan mengklarifikasi kembali.";
}


it seems that the validator, didn't cache the valid captcha and, directly invalidate the last one on the validate functional
0

#2 User is offline   Maurizio Domba 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,229
  • Joined: 12-October 09
  • Location:Croatia

Posted 01 March 2013 - 05:19 AM

Note that with your code

$model->validate() && $model->save()

the validation is done 2 times!


Find more about me.... btw. Do you know your WAN IP?
0

#3 User is offline   xicond 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 32
  • Joined: 06-October 12

Posted 04 March 2013 - 06:51 PM

View PostMaurizio Domba, on 01 March 2013 - 05:19 AM, said:

Note that with your code

$model->validate() && $model->save()

the validation is done 2 times!




Yes, but on my idealistic, whatever condition I run on mycode, it shouldn't impact for invalidation the captcha, the captcha should only invalidate on user attempt...

is any best way to reach it?
0

#4 User is offline   Maurizio Domba 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,229
  • Joined: 12-October 09
  • Location:Croatia

Posted 04 March 2013 - 07:00 PM

Did you try with just $model->save() ?

makes no sense to do the validation 2 consecutive times.
Find more about me.... btw. Do you know your WAN IP?
0

#5 User is offline   xicond 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 32
  • Joined: 06-October 12

Posted 06 March 2013 - 02:39 AM

View PostMaurizio Domba, on 04 March 2013 - 07:00 PM, said:

Did you try with just $model->save() ?

makes no sense to do the validation 2 consecutive times.


Yes, that's the only solution, somehow, I need to make a test validate before do a save action,
that's upper sample just a short example, not the real code.

if on same action there's 1 var name branching conditional to two kind of model, one is modelform, the other is cactiverecord,

- so in the modelform object type, I can do validate and call save method own created,

- but on other flow come in the cactiverecord, it getting error
0

#6 User is offline   Maurizio Domba 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,229
  • Joined: 12-October 09
  • Location:Croatia

Posted 06 March 2013 - 03:47 AM

Well if you need to validate before the save... then you can use $model->save(false) so that the second time validation is not performed...
Find more about me.... btw. Do you know your WAN IP?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users