PHP Class Swoole\Auth

Author: Han Tianfeng
显示文件 Open project: matyhtf/swoole_framework Class Usage Examples

Public Properties

Property Type Description
$cookie_life
$db
$dict
$errCode
$errMessage
$is_login
$lastip
$lastlogin
$login_url
$mk_password
$password
$password_cost
$password_hash
$password_salt_size
$profile
$select
$session_destroy
$session_prefix
$user
$userid
$username

Protected Properties

Property Type Description
$config
$login_db
$login_table
$profile_table

Public Methods

Method Description
__construct ( $config )
autoLogin ( ) 自动登录,如果自动登录则在本地记住密码
changePassword ( $uid, $old_pwd, $new_pwd ) : boolean 修改密码
getUid ( ) : integer 获取登录用户的UID
getUserInfo ( $key = 'userinfo' ) : array 获取登录用户的信息
isLogin ( ) : boolean 检查是否登录
login ( $username, $password, boolean $auto_login = false ) : boolean 登录
loginRequire ( ) : boolean 验证登录
logout ( ) : boolean 注销登录
makePasswordHash ( $username, $password ) : string 产生一个密码串,连接用户名和密码,并使用sha1产生散列
saveUserinfo ( $key = 'userinfo' )
setSession ( $key )
updateStatus ( $set = null ) : boolean 更新用户信息
verifyPassword ( $username, $input_password, $real_password ) : boolean 验证密码

Method Details

__construct() public method

public __construct ( $config )

autoLogin() public method

自动登录,如果自动登录则在本地记住密码
public autoLogin ( )

changePassword() public method

修改密码
public changePassword ( $uid, $old_pwd, $new_pwd ) : boolean
$uid
$old_pwd
$new_pwd
return boolean

getUid() public method

获取登录用户的UID
public getUid ( ) : integer
return integer

getUserInfo() public method

获取登录用户的信息
public getUserInfo ( $key = 'userinfo' ) : array
return array

isLogin() public method

检查是否登录
public isLogin ( ) : boolean
return boolean

login() public method

登录
public login ( $username, $password, boolean $auto_login = false ) : boolean
$username
$password
$auto_login boolean 是否自动登录
return boolean

loginRequire() public static method

验证登录
public static loginRequire ( ) : boolean
return boolean

logout() public method

注销登录
public logout ( ) : boolean
return boolean

makePasswordHash() public static method

产生一个密码串,连接用户名和密码,并使用sha1产生散列
public static makePasswordHash ( $username, $password ) : string
$username
$password
return string

saveUserinfo() public method

public saveUserinfo ( $key = 'userinfo' )

setSession() public method

public setSession ( $key )

updateStatus() public method

更新用户信息
public updateStatus ( $set = null ) : boolean
$set
return boolean

verifyPassword() public static method

验证密码
public static verifyPassword ( $username, $input_password, $real_password ) : boolean
$username
$input_password
$real_password
return boolean

Property Details

$config protected_oe property

protected $config

$db public_oe property

public $db

$dict public_oe property

public $dict

$errCode public_oe property

public $errCode

$errMessage public_oe property

public $errMessage

$is_login public_oe property

public $is_login

$lastip static_oe public_oe property

static public $lastip

$lastlogin static_oe public_oe property

static public $lastlogin

$login_db protected_oe property

protected $login_db

$login_table protected_oe property

protected $login_table

$login_url static_oe public_oe property

static public $login_url

$mk_password static_oe public_oe property

static public $mk_password

$password static_oe public_oe property

static public $password

$password_cost static_oe public_oe property

static public $password_cost

$password_hash static_oe public_oe property

static public $password_hash

$password_salt_size static_oe public_oe property

static public $password_salt_size

$profile public_oe property

public $profile

$profile_table protected_oe property

protected $profile_table

$select public_oe property

public $select

$session_destroy static_oe public_oe property

static public $session_destroy

$session_prefix static_oe public_oe property

static public $session_prefix

$user public_oe property

public $user

$userid static_oe public_oe property

static public $userid

$username static_oe public_oe property

static public $username