On the internet, we usually register a user who has a valid e-mail account. You may use yii skeleton application by Jonah for this purpose.
On the other hand, especially in a specific project in a certain corporation, user authentication can be simplified. For this purpose, I have built a simplified user authentication module named 'simpleLogin'.
This module enables the registration of an unknown user immediately. It is very useful for project members who can be trusted in the above situation.

yiic.$ cd {yiiPath}/demos
$ ../framework/yiic webapp {appName}
$ cd {appName}/protected
$ {textEditor} config/main.php
'components'=>array( ... 'user'=>array( ... 'loginUrl'=>array('simpleLogin'), ), ), ... 'modules'=>array( 'simpleLogin', ), ...
protected.
The module is stored under
protected/modules/.
$ rm data/testdrive.db $ sqlite3 data/testdrive.db <modules/simleLogin/schema.sqlite.sql
$ chmod 777 data $ chmod 666 data/testdrive.db
See the following code example of views/layouts/main.php. You can replace existing login functionality as below.
- array('label'=>'Login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest), + array('label'=>'SimpleLogin', 'url'=>array('/simpleLogin'), 'visible'=>Yii::app()->user->isGuest), + array('label'=>'Delete', 'url'=>array('/simpleLogin/Default/delete'), 'visible'=>!Yii::app()->user->isGuest), array('label'=>'Logout', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest)
Total 3 comments
As a beginner, I really like it. It won't confuse me, and the structure is very clear.
Hi Trejder I hope you didn't overlook the scenario: corporate intranet as opposed to the wide open internet. Neat.
A very interesting idea this extension provides - if user is not found in the DB, it's account will be automatically created without requiring him to go through standard registration process. Good job!
Leave a comment
Please login to leave your comment.