Yii 1.1: simplelogin

A simplified user authentication & registration module

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.





  • Yii 1.1 or above

Installation example for skeleton application

  • Make a skeleton application by using yiic.
$ cd {yiiPath}/demos
$ ../framework/yiic webapp {appName}
$ cd {appName}/protected
$ {textEditor} config/main.php 
  • Edit the configuration file so as to enable the module and the corresponding database.
  • Extract the release file under protected.

Note: The module is stored under protected/modules/.

  • Make the database.
$ rm data/testdrive.db
$ sqlite3 data/testdrive.db <modules/simleLogin/schema.sqlite.sql
  • Change the permission of the database.
$ 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)

Change Log

June 23, 2009

  • Initial release (r3)

June 24, 2009

  • Added user delete functionality (r4)

June 25, 2009

  • Added listing functionality for registered users (r5)

August 5, 2009

  • Added default user->loginUrl in 'config/main.php' in the documentation. No need to update the extension.

August 6, 2009

  • Fixed returnUrl bug (r8)

August 26, 2010

  • Adapted to current skeleton application (r16)

Total 3 comments

#3485 report it
nettrinity at 2011/04/15 12:03am
I really like this simple login

As a beginner, I really like it. It won't confuse me, and the structure is very clear.

#2256 report it
jacmoe at 2010/12/02 02:07pm
Auto-register for intranets

Hi Trejder I hope you didn't overlook the scenario: corporate intranet as opposed to the wide open internet. Neat.

#2230 report it
Trejder at 2010/11/29 08:13am
Auto-register: Interesting idea

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 to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: New BSD License
  • Developed by: mocapapa
  • Category: Auth
  • Votes: +2
  • Downloaded: 2,918 times
  • Created on: Jun 23, 2009
  • Last updated: Aug 26, 2010