Skip to content
Browse files

user auth from config file

  • Loading branch information...
1 parent 301dfcc commit 17259ef3a733299ff149c57359369b6cf4067400 Attila Dobi committed Jan 16, 2012
Showing with 23 additions and 3 deletions.
  1. +1 −1 application/config/constants.php
  2. +17 −0 application/config/user.php
  3. +5 −2 application/controllers/auth.php
View
2 application/config/constants.php
@@ -36,7 +36,7 @@
define('FOPEN_WRITE_CREATE_STRICT', 'xb');
define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
-define('SITE_TITLE', '');
+define('SITE_TITLE', 'SITE NAME');
/* End of file constants.php */
/* Location: ./application/config/constants.php */
View
17 application/config/user.php
@@ -0,0 +1,17 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/*
+| -------------------------------------------------------------------------
+| Hooks
+| -------------------------------------------------------------------------
+| This file lets you define "hooks" to extend CI without hacking the core
+| files. Please see the user guide for info:
+|
+| http://codeigniter.com/user_guide/general/hooks.html
+|
+*/
+
+$config['username'] = 'admin';
+$config['password'] = 'a';
+
+/* End of file hooks.php */
+/* Location: ./application/config/user.php */
View
7 application/controllers/auth.php
@@ -1,4 +1,4 @@
-<?php
+<?php
if (! defined('BASEPATH')) exit('No direct script access');
@@ -32,7 +32,10 @@ public function check_credentials()
//$user = $this->users->login($_POST['username'], md5($_POST['password']));
//dump($_POST); die;
- if ($_POST['username'] === 'admin' && md5($_POST['password']) === md5('a')) {
+
+ $this->config->load('user');
+
+ if ($_POST['username'] === $this->config->item('username') && md5($_POST['password']) === md5($this->config->item('password'))) {
$this->session->set_userdata('logged_in', true);

0 comments on commit 17259ef

Please sign in to comment.
Something went wrong with that request. Please try again.