cakephp-3.0

CakePHP 3 DefaultPasswordHasher

早过忘川 提交于 2021-02-05 06:10:30
问题 I am working on creating an authentication form that has a password and password_again field in it. So I can check to make sure they match, I am using the beforeSave() function of my UsersTable to take care of the hashing. As a test, I have just set it to show me the password_again, its hashed result and then die. public function beforeSave($event, $entity){ debug($entity->password_again); $hasher = new DefaultPasswordHasher(); $entity->password_again = $hasher->hash($entity->password_again);

CakePHP 3.6.10 disable completely CSRF token check

▼魔方 西西 提交于 2021-01-29 06:08:38
问题 I need to completely disable the control of the CSRF token for my application. I tried to use: public function beforeFilter(Event $event) { $this->getEventManager()->off($this->Csrf); } In AppController but it does not seem to work. Manual link: Disabling the CSRF Component for Specific Actions I did a lot of tests, read many posts but I could not solve. Ty. @omerowitz This is my AppController before filter action: public function beforeFilter(Event $event) { $this->getEventManager()->off(

Search with concat fields in cakephp 3

感情迁移 提交于 2021-01-28 04:44:01
问题 I need to make a search query using $this->Paginate in CakePHP 3. Following is the code I am using $searchCondition = array( 'OR' => array( 'Quotes.quotenum LIKE' => "%" . $this->request->data['Quote']['keyword'] . "%", 'Branches.name LIKE' => '%' . $this->request->data['Quote']['keyword'] . '%', 'Contacts.fname LIKE' => '%' . $this->request->data['Quote']['keyword'] . '%', 'Contacts.lname LIKE' => '%' . $this->request->data['Quote']['keyword'] . '%', 'CONCAT(Contacts.fname, Contacts.lname)

What's the recommended approach for updating the core lib of a Cakephp3 app

戏子无情 提交于 2021-01-28 04:42:43
问题 I've used composer to install CakePHP 3 while it still was in development, so the composer.json file contains dev-versions. The composer.json file looks like this right now: { "name": "cakephp/app", "description": "CakePHP skeleton app", "homepage": "http://cakephp.org", "type": "project", "license": "MIT", "require": { "php": ">=5.4.16", "cakephp/cakephp": "3.0.*-dev", "mobiledetect/mobiledetectlib": "2.*", "cakephp/migrations": "dev-master", "cakephp/plugin-installer": "*" }, "require-dev":

Cakephp3: Render/Evaluate HTML inside label formhelper

情到浓时终转凉″ 提交于 2021-01-27 04:21:53
问题 How you place html inside label in cakephp3? I need to achieve * Name: using the code below <?php echo $this->Form->input ( 'name', [ 'label' => [ 'text' => '<span class="red">*</span> Name:', 'class' => 'col-sm-12 col-md-2 col-lg-1 control-label' ], 'class' => 'form-control', 'rows' => 1 ] ); 回答1: Pretty much as always, use the escape option. echo $this->Form->input('name', [ 'label' => [ // ... 'escape' => false ], // ... ]); 来源: https://stackoverflow.com/questions/27991447/cakephp3-render

Login with username or email with Cakephp 3

南楼画角 提交于 2020-12-28 21:03:29
问题 I want to do a login with username or email. So I want to change Auth fields dynamically. How can I modify $this->Auth fields as Cakehp 2 did? In cakephp 2 you could do: $this->Auth->authenticate = array( 'Form' => array( 'fields' => array('username' => 'email', 'password' => 'password'), ), ); I've tried to change authenticate like this but it doesn't work: $this->Auth->config('authenticate', [ 'Form' => [ 'fields' => ['username' => 'email', 'password' => 'password'] ] ]); Thanks! 回答1: I've

Cake 3.x How to setup a queue technology for jobs and news feeds?

前提是你 提交于 2020-07-19 18:32:49
问题 I am using Cake 3.x I need to have the following things set up. A job queue to queue jobs that require long processing in the background A feed (like Facebook Feed) that informs various users of what's happening within the app This is what I have in terms of requirements: Job Queue This needs to be persistent and reliable. Meaning to say if the server suddenly rebooted, any jobs queued but not yet executed will still be there waiting to be processed upon reboot. News Feed / Activity Stream