# How to create data validation steps

**URL:** <https://discourse.cakephp.org/t/how-to-create-data-validation-steps/8095>\
**Category:** Uncategorized\
**Created:** [July 19, 2020, 12:18am UTC](https://discourse.cakephp.org/t/how-to-create-data-validation-steps/8095 "2020-07-19T00:18:09Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![yvesroma190](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/yvesroma190/32/1926_2.png) [@yvesroma190](https://discourse.cakephp.org/u/yvesroma190)\
**Post date:** [July 19, 2020, 12:18am UTC](https://discourse.cakephp.org/t/how-to-create-data-validation-steps/8095/1 "2020-07-19T00:18:09Z")

</div>

Good morning all,

I am new to cakephp. Here is my concern, I am practicing to design an online subscription site. The customer arrived on the site clicks on an offer to subscribe and must be redirected to a customer information registration form then after validation, is directed to another page which displays the details of his subscription and finally he confirms his subscription . The problem is that I don’t know how to go about keeping information in memory at each stage of form validation.

Could help me to have a tip or method to overcome this problem. I thank you in advance.

I’m using the cakephp 3.8 version

---

<div class="post-metadata">

**Author:** ![dreamingmind](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/dreamingmind/32/1857_2.png) [@dreamingmind](https://discourse.cakephp.org/u/dreamingmind)\
**Post date:** [July 19, 2020, 1:59am UTC](https://discourse.cakephp.org/t/how-to-create-data-validation-steps/8095/2 "2020-07-19T01:59:13Z")

</div>

One common way is to use [sessions](https://book.cakephp.org/4/en/development/sessions.html). This one of the strategies use by the [Authentication plugin](https://book.cakephp.org/authentication/2/en/index.html) too.

---

<div class="post-metadata">

**Author:** ![yvesroma190](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/yvesroma190/32/1926_2.png) [@yvesroma190](https://discourse.cakephp.org/u/yvesroma190)\
**Post date:** [July 19, 2020, 3:41am UTC](https://discourse.cakephp.org/t/how-to-create-data-validation-steps/8095/3 "2020-07-19T03:41:31Z")

</div>

I have a customer table, an offer table and a subscription table and I would like to use the customer table for authentication but this does not go out. I have reserved the user table for the administration part. Do you have a solution for me? I’m grateful to you.

---

<div class="post-metadata">

**Author:** ![dreamingmind](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/dreamingmind/32/1857_2.png) [@dreamingmind](https://discourse.cakephp.org/u/dreamingmind)\
**Post date:** [July 19, 2020, 3:47am UTC](https://discourse.cakephp.org/t/how-to-create-data-validation-steps/8095/4 "2020-07-19T03:47:13Z")

</div>

Are you trying to save the customer record to a session so you can retrieve it on subsequent requests?

Can you share some code showing where your process is failing?

---

<div class="post-metadata">

**Author:** ![yvesroma190](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/yvesroma190/32/1926_2.png) [@yvesroma190](https://discourse.cakephp.org/u/yvesroma190)\
**Post date:** [July 19, 2020, 3:01pm UTC](https://discourse.cakephp.org/t/how-to-create-data-validation-steps/8095/5 "2020-07-19T15:01:20Z")

</div>

I present you the codes that I put for the authentication of the customers before they subscribe to an offer  
appController

 ![1_AppControler](https://canada1.discourse-cdn.com/flex029/uploads/cakephp/original/2X/7/72c490d7850942d44686a4354bab9b68268669f3.jpeg)

ClientsController

 ![2_ClientsController](https://canada1.discourse-cdn.com/flex029/uploads/cakephp/original/2X/a/ab9df15a6a5e669c38d2870d6189dee770f59fcf.jpeg)  
Client Entity  
 ![3_Client_Entity](https://canada1.discourse-cdn.com/flex029/uploads/cakephp/original/2X/4/427e804ba37d76ea5712968a3be32d950214c9cc.jpeg)  
Template login  
 ![4_Login_Ctp](https://canada1.discourse-cdn.com/flex029/uploads/cakephp/original/2X/6/63ddd0d8eaa3f9f4ebf11d9a114ab703b93afc58.jpeg)  
When client want to subscribe  
 ![5_Souscription](https://canada1.discourse-cdn.com/flex029/uploads/cakephp/original/2X/d/d9104193bc67649bca1625595c200a09cbf369f6.jpeg)

at first, the client’s authentication does not work after creation of his account.

---

<div class="post-metadata">

**Author:** ![dreamingmind](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/dreamingmind/32/1857_2.png) [@dreamingmind](https://discourse.cakephp.org/u/dreamingmind)\
**Post date:** [July 19, 2020, 5:09pm UTC](https://discourse.cakephp.org/t/how-to-create-data-validation-steps/8095/6 "2020-07-19T17:09:04Z")

</div>

How is it failing?

- Is there an error message?
- Are the expected records being created in the database?
- Is the password hashed in the database as expected?
- Is there any Auth data showing in the session?

---

<div class="post-metadata">

**Author:** ![yvesroma190](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/yvesroma190/32/1926_2.png) [@yvesroma190](https://discourse.cakephp.org/u/yvesroma190)\
**Post date:** [July 19, 2020, 9:31pm UTC](https://discourse.cakephp.org/t/how-to-create-data-validation-steps/8095/7 "2020-07-19T21:31:01Z")

</div>

How is it failing?

the records are created in the database  
passwords are hashed

 ![Database](https://canada1.discourse-cdn.com/flex029/uploads/cakephp/original/2X/2/2c4fa00ce6b22146d511994519b4acff67c4ddbf.jpeg)  
But when I try to connect a client, I get the following error message: email or password is incorrect  
 ![Error](https://canada1.discourse-cdn.com/flex029/uploads/cakephp/original/2X/0/09eb099a473722091171a7269dd9b2fcd2930332.jpeg)

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [July 19, 2020, 9:57pm UTC](https://discourse.cakephp.org/t/how-to-create-data-validation-steps/8095/8 "2020-07-19T21:57:46Z")

</div>

You’re trying to log in with a user record stored in the clients table? What steps have you taken to set that as the table that will be used for authenticating those logins?

---

<div class="post-metadata">

**Author:** ![yvesroma190](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/yvesroma190/32/1926_2.png) [@yvesroma190](https://discourse.cakephp.org/u/yvesroma190)\
**Post date:** [July 19, 2020, 10:19pm UTC](https://discourse.cakephp.org/t/how-to-create-data-validation-steps/8095/9 "2020-07-19T22:19:14Z")

</div>

I changed the code in the AppController file

 ![1_AppControler](https://canada1.discourse-cdn.com/flex029/uploads/cakephp/original/2X/7/72c490d7850942d44686a4354bab9b68268669f3.jpeg)

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [July 20, 2020, 12:27am UTC](https://discourse.cakephp.org/t/how-to-create-data-validation-steps/8095/10 "2020-07-20T00:27:25Z")

</div>

Nothing about this changes what _table_ it will be looking in. It changes what _controller_ will be used, but that controller just calls `$this->Auth->identify()`, and by default that’s going to be using the `users` table.

---

<div class="post-metadata">

**Author:** ![yvesroma190](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/yvesroma190/32/1926_2.png) [@yvesroma190](https://discourse.cakephp.org/u/yvesroma190)\
**Post date:** [July 20, 2020, 1:23am UTC](https://discourse.cakephp.org/t/how-to-create-data-validation-steps/8095/11 "2020-07-20T01:23:31Z")

</div>

> [@Zuluru](#):
>
> Nothing about this changes what _table_ it will be looking in. It changes what _controller_ will be used, but that controller just calls `$this->Auth->identify()` , and by default that’s going to be using the `users` table.

In this case do you have a solution for me?

---

<div class="post-metadata">

**Author:** ![yvesroma190](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/yvesroma190/32/1926_2.png) [@yvesroma190](https://discourse.cakephp.org/u/yvesroma190)\
**Post date:** [July 20, 2020, 1:24am UTC](https://discourse.cakephp.org/t/how-to-create-data-validation-steps/8095/12 "2020-07-20T01:24:28Z")

</div>

I am a beginner in cakephp

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [July 20, 2020, 3:54pm UTC](https://discourse.cakephp.org/t/how-to-create-data-validation-steps/8095/13 "2020-07-20T15:54:26Z")

</div>

Documentation is [here](https://book.cakephp.org/3/en/controllers/components/authentication.html#configuring-authentication-handlers), see the `userModel` key.

---

<div class="post-metadata">

**Author:** ![yvesroma190](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/yvesroma190/32/1926_2.png) [@yvesroma190](https://discourse.cakephp.org/u/yvesroma190)\
**Post date:** [July 21, 2020, 1:32pm UTC](https://discourse.cakephp.org/t/how-to-create-data-validation-steps/8095/14 "2020-07-21T13:32:02Z")

</div>

Thank you. I consult and I come back to you

---

<div class="post-metadata">

**Author:** ![yvesroma190](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/yvesroma190/32/1926_2.png) [@yvesroma190](https://discourse.cakephp.org/u/yvesroma190)\
**Post date:** [August 1, 2020, 11:38pm UTC](https://discourse.cakephp.org/t/how-to-create-data-validation-steps/8095/15 "2020-08-01T23:38:39Z")

</div>

Thank you all for your help
