Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Authlite 2.0 for Kohana 3.0 has now begun alpha testing. :)
- Loading branch information
Fred Wu
committed
Oct 31, 2009
1 parent
deac55c
commit 87e6cda
Showing
4 changed files
with
91 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php defined('SYSPATH') or die('No direct script access.'); | ||
|
||
class Controller_User extends Controller | ||
{ | ||
public function action_login() | ||
{ | ||
empty($_POST) or $this->authlite->login($_POST['username'], $_POST['password'], TRUE); | ||
|
||
if ($this->authlite->logged_in()) { | ||
$this->request->redirect(''); | ||
} elseif ( ! empty($_POST)) { | ||
// login error message | ||
} | ||
} | ||
|
||
public function action_logout() | ||
{ | ||
$this->authlite->logout(); | ||
$this->request->redirect(''); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,43 @@ | ||
<?php | ||
<?php defined('SYSPATH') or die('No direct access allowed.'); | ||
|
||
/** | ||
* User model | ||
*/ | ||
$config['user_model'] = 'user'; | ||
|
||
/** | ||
* Username column | ||
*/ | ||
$config['username'] = 'username'; | ||
|
||
/** | ||
* Password column | ||
*/ | ||
$config['password'] = 'password'; | ||
|
||
/** | ||
* Session column | ||
*/ | ||
$config['session'] = 'session'; | ||
|
||
/** | ||
* Type of hash to use for passwords. Any algorithm supported by the hash function | ||
* can be used here. | ||
* @see http://php.net/hash | ||
* @see http://php.net/hash_algos | ||
*/ | ||
$config['hash_method'] = 'sha1'; | ||
|
||
/** | ||
* Set the auto-login (remember me) cookie lifetime, in seconds. The default | ||
* lifetime is two weeks. | ||
*/ | ||
$config['lifetime'] = 1209600; | ||
|
||
/** | ||
* Set the session key that will be used to store the current user. | ||
*/ | ||
$config['session_key'] = 'authlite_user'; | ||
return array | ||
( | ||
/** | ||
* User model | ||
*/ | ||
'user_model' => 'user', | ||
|
||
/** | ||
* Username column | ||
*/ | ||
'username' => 'username', | ||
|
||
/** | ||
* Password column | ||
*/ | ||
'password' => 'password', | ||
|
||
/** | ||
* Session column | ||
*/ | ||
'session' => 'session', | ||
|
||
/** | ||
* Type of hash to use for passwords. Any algorithm supported by the hash function | ||
* can be used here. | ||
* @see http://php.net/hash | ||
* @see http://php.net/hash_algos | ||
*/ | ||
'hash_method' => 'sha1', | ||
|
||
/** | ||
* Set the auto-login (remember me) cookie lifetime, in seconds. The default | ||
* lifetime is two weeks. | ||
*/ | ||
'lifetime' => 1209600, | ||
|
||
/** | ||
* Set the session key that will be used to store the current user. | ||
*/ | ||
'session_key' => 'authlite_user', | ||
); |