Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>He means store the original "John" in database, then strtolower the database saved value, and the inputed name on the login form. Then you still have the same usernames the way they were registered.</p> <p>Example Added:</p> <p>Login.ctp</p> <pre><code>echo $this-&gt;Form-&gt;create('User', array('url' =&gt; array('controller' =&gt; 'users', 'action' =&gt; 'register'))); echo $this-&gt;Form-&gt;input('User.username', array('label' =&gt; 'First Name:')); echo $this-&gt;Form-&gt;input('User.password', array('label' =&gt; 'Password', 'type' =&gt; 'password', 'value' =&gt; false)); echo $this-&gt;Form-&gt;submit('Register'); echo $this-&gt;Form-&gt;end(); </code></pre> <p>Consider that when the user inputs there username and password. Say I am using the username "John". The capital J is what we want to make sure is in the database. We are not going to use strtolower when saving data. So by using a cake's save() method we can accomplish saving your case sensitive issue.</p> <p>register.ctp</p> <pre><code>public function register() { if ($this-&gt;Auth-&gt;loggedIn()) { $this-&gt;redirect(array('controller' =&gt; 'users', 'action' =&gt; 'login')); } if ($this-&gt;request-&gt;is('post')) { if ($this-&gt;User-&gt;User-&gt;saveAll($this-&gt;request-&gt;data) { $this-&gt;Session-&gt;setFlash(__('Your account has been created', true)); $this-&gt;redirect(array('controller' =&gt; 'users', 'action' =&gt; 'index')); }} </code></pre> <p>Now when we do login action:</p> <pre><code>if ($this-&gt;request-&gt;is('post')) { if ($this-&gt;Auth-&gt;loggedIn()) { $logged = $this-&gt;User-&gt;query('Your sql query matching username/password with strtolower, if you need to implement security hash from cakephp you can do that through cakephp hash method'); } } </code></pre> <p>Basic example but it should help</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload