Decode password
- Single Page
Posted 21 May 2012 - 06:03 AM
I want to show password to user for edit.I kept password in database after encryption.How can I decrypt password when show in edit mode.It show encrypted password.
Thanks in advance
Shahin
Posted 21 May 2012 - 06:10 AM
http://www.grocerycr...tiondecryption/
Posted 21 May 2012 - 06:26 AM
Very very thanks.But I want to access 'password field' from a different table.That means I used $crud->set_relation().My code is like this:->
...................................................................................................................................................................................................................................
function personal_details()
{
$crud = new grocery_crud();
$crud->set_field_upload('photo', 'assets/uploads/profile_picture');
$crud->set_relation('login_id', 'login','password');
$crud->set_relation('status_id', 'status','status');
$crud->display_as('status_id','Status')->display_as('login_id','Password');
$crud->callback_edit_field('password',array($this,'decrypt_password_callback'));
$crud->unset_fields('created_at','updated_at');
$output = $crud->render();
$title = "Profile";
$this-> _example_output($output,$title);
}
function decrypt_password_callback($value)
{
$this->load->library('encrypt');
$key = 'super-secret-key';
$decrypted_password = $this->encrypt->decode($value, $key);
return "<input type='password' name='password' value='$decrypted_password' />";
}
............................................................................................................................................................................................................................................
I have two tables
1.login[list]
[*]id
[*]username
[*]password
[/list]
2.personal_details[list]
[*]id
[*]login_id(To access password)
[/list]
Egarly waiting for your response.
Thanks in advance
Shahin
Posted 21 May 2012 - 06:35 AM
I think you missed
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('[color=#282828][font=helvetica, arial, sans-serif]login[/font][/color]'); // This line......
See Example function here http://www.grocerycrud.com/documentation/options_functions/set_relation :
function employees_management()
{
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('employees');
$crud->display_as('officeCode','Office City');
$crud->set_subject('Employee');
$crud->set_relation('officeCode','offices','city');
$output = $crud->render();
$this->_example_output($output);
}
Thanks
Posted 21 May 2012 - 06:38 AM
Your callback function is get called or not?