From d3377cf62e61c26cc4d8ebd7dd9fe396c08a1a08 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Wed, 17 Jul 2013 13:57:41 +0300 Subject: [PATCH] Moved passwordhash() from yllapito controller to user model, where it belongs --- application/controllers/yllapito.php | 14 ++------------ application/models/user_model.php | 8 ++++++++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/application/controllers/yllapito.php b/application/controllers/yllapito.php index b80c972..105a167 100644 --- a/application/controllers/yllapito.php +++ b/application/controllers/yllapito.php @@ -175,7 +175,7 @@ class Yllapito extends CI_Controller $pass = $this->input->post('password'); // Hash the password - $pass = $this->passwordhash($pass); + $pass = $this->users->passwordhash($pass); $test = array( 'username' => $user, @@ -227,16 +227,6 @@ class Yllapito extends CI_Controller public function makePassword($password = null) { - echo $this->passwordhash($password); - } - - - - private function passwordhash($password = null) - { - return hash( - 'ripemd160', - $password . $this->config->item('encryption_key') - ); + echo $this->users->passwordhash($password); } } diff --git a/application/models/user_model.php b/application/models/user_model.php index f1b76e5..2751145 100644 --- a/application/models/user_model.php +++ b/application/models/user_model.php @@ -12,6 +12,14 @@ class User_model extends MY_Model parent::__construct(); } + public function passwordhash($password = null) + { + return hash( + 'ripemd160', + $password . $this->config->item('encryption_key') + ); + } + protected function timestamps($ecard) { $ecard['created_at'] = $ecard['updated_at'] = date('Y-m-d H:i:s');