I have a MySQL database and User table. I store different types of users with different roles in User table.
I am using CakePHP framework. In my core.php
file, I have added SALT and HASH code for storing the encrypted password in DB. Now everything is good here so far. And CakePHP will make sure to stored encrypted password in DB.
Consider this scenario: I am trying to register the Webmaster/WebAdmin user. I will not be able to provide the Register User link for WebMaster. Only from back-end I should be able to add the WebAdmin/Webmaster user.
So I need to be able to create the Admin user and store his password using the SQL statement and utilizing the same HASH and SALT used by CakePHP to authorize/authenticate the WebAdmin user from front-end page.
I am not very familiar with how to write this type of SQL statement for MySQL DB to accomplish this task. And I am not sure if this is even achievable. How to accomplish this?
If nothing works then I will have to provide a temp View to register and then remove this view from the code. But I do not really like this option if there is a way to achieve this using SQL statement on MySQL DB.