From f3cb1c31e30a0d31eb545439fe3ad7da68ccb189 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Thu, 3 May 2012 16:36:05 +0200 Subject: user/hash_password: add form to support normal browsers Signed-off-by: Florian Pritz --- application/controllers/user.php | 18 ++++++++++++++++-- application/views/user/hash_password.php | 26 ++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 application/views/user/hash_password.php (limited to 'application') diff --git a/application/controllers/user.php b/application/controllers/user.php index a32b930d2..204612b2d 100644 --- a/application/controllers/user.php +++ b/application/controllers/user.php @@ -192,8 +192,22 @@ class User extends CI_Controller { function hash_password() { + $process = $this->input->post("process"); $password = $this->input->post("password"); - echo "hashing $password: "; - echo $this->muser->hash_password($password); + $password_confirm = $this->input->post("password_confirm"); + $this->data["hash"] = false; + $this->data["password"] = $password; + + if ($process) { + if (!$password || $password != $password_confirm) { + $error[]= "No password or passwords don't match."; + } else { + $this->data["hash"] = $this->muser->hash_password($password); + } + } + + $this->load->view($this->var->view_dir.'header', $this->data); + $this->load->view($this->var->view_dir.'hash_password', $this->data); + $this->load->view($this->var->view_dir.'footer', $this->data); } } diff --git a/application/views/user/hash_password.php b/application/views/user/hash_password.php new file mode 100644 index 000000000..a0aa88ce5 --- /dev/null +++ b/application/views/user/hash_password.php @@ -0,0 +1,26 @@ +"; + echo implode("
\n", $error); + echo "

"; +} + +if ($hash) { + echo "

Result (this hash uses a random salt, so it will be different each time you submit this form):
$hash

\n"; +} +?> + + + + + + + + + + + + +
Password
Confirm password
+ + -- cgit v1.2.3-24-g4f1b