uldisn/yii-user

用户管理模块

安装次数: 7,653

依赖者: 1

建议者: 0

安全性: 0

星标: 1

关注者: 6

分支: 154

开放问题: 4

类型:yii-extension

1.0.3 2015-04-19 08:39 UTC

This package is auto-updated.

Last update: 2024-09-22 11:56:32 UTC


README

下载

http://yii-user.2mx.org下载或检出(SVN/Git),然后在您的protected/modules/user目录中解压文件

Git检出

clone git git@github.com:mishamx/yii-user.git

配置

修改您的config/main

return array(
    #...
    // autoloading model and component classes
    'import'=>array(
        'application.models.*',
        'application.components.*',
        'application.modules.user.models.*',
        'application.modules.user.components.*',
    ),

    #...
    'modules'=>array(
        #...
        'user'=>array(
            # encrypting method (php hash function)
            'hash' => 'md5',

            # send activation email
            'sendActivationMail' => true,

            # allow access for non-activated users
            'loginNotActiv' => false,

            # activate user on registration (only sendActivationMail = false)
            'activeAfterRegister' => false,

            # automatically login from registration
            'autoLogin' => true,

            # guests allow register
            'allowGuestRegister' => true,

            # show user list
            'showUserList' => true,

            # alow to user edit self profile
            'allowUserEditProfile' => true,

            # registration path
            'registrationUrl' => array('/user/registration'),

            # recovery password path
            'recoveryUrl' => array('/user/recovery'),

            # login form path
            'loginUrl' => array('/user/login'),

            # page after login
            'returnUrl' => array('/user/profile'),

            # page after logout
            'returnLogoutUrl' => array('/user/login'),
        ),
        #...
    ),

    #...
    // application components
    'components'=>array(
    #...
        'db'=>array(
        #...
            'tablePrefix' => 'tbl_',
        #...
        ),
        #...
        'user'=>array(
            // enable cookie-based authentication
            'class' => 'WebUser',
        ),
    #...
    ),
    #...
);

修改您的config/console

return array(
    #...
    'modules'=>array(
        #...
        'user'=>array(
            # encrypting method (php hash function)
            'hash' => 'md5',

            # send activation email
            'sendActivationMail' => true,

            # allow access for non-activated users
            'loginNotActiv' => false,

            # activate user on registration (only sendActivationMail = false)
            'activeAfterRegister' => false,

            # automatically login from registration
            'autoLogin' => true,

            # registration path
            'registrationUrl' => array('/user/registration'),

            # recovery password path
            'recoveryUrl' => array('/user/recovery'),

            # login form path
            'loginUrl' => array('/user/login'),

            # page after login
            'returnUrl' => array('/user/profile'),

            # page after logout
            'returnLogoutUrl' => array('/user/login'),
        ),
        #...
    ),
    #...
);

安装

运行命令:yiic migrate --migrationPath=user.migrations

输入管理员登录名、电子邮件和密码