codecollab/authentication 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

codecollab/authentication

最新稳定版本:1.0.0

Composer 安装命令:

composer require codecollab/authentication

包简介

Authentication package of the CodeCollab project

README 文档

README

Authentication package of the CodeCollab project

Build Status MIT License Latest Stable Version Total Downloads Latest Unstable Version

Requirements

PHP7+

Installation

Include the library in your project using composer:

{
    "require-dev": {
        "codecollab/authentication": "^1"
    }
}

Usage

Creating an instance of User requires an instance of \CodeCollab\Http\Session\Session from the Http Library

User Authentication

The logIn function takes as arguments the password from the form, the password hash from the database and the user's information (to be persisted in Session).

$user = new User($session);
if ($user->logIn($password_from_form, $hash_from_db, $user_info_from_db)) {
    /** login successful **/
} else {
    /** login failed */
}

Assuming there's a "remember me" feature implemented a user can simply be logged in without comparing password hashes.

if ($user->logInRememberMe($user_info_from_db)) {
    /** login successful **/
} else {
    /** login failed */
}

After a successful login, the user's information can be retrieved depending on what $user_info_from_db (in above snippet) contained:

$user_name = $session->get('user_name');
$user_id = $session->get('user_id');

Login Status

if ($user->isLoggedIn() {
    /** User is logged in **/
}

Password Rehash

To check for and rehash (when needed) a logged in user's password:

if ($user->needsRehash($hash_from_db)) {
    $new_hash = $user->rehash($password_from_form);
    //save $new_hash to database
}

Logout

$user->logOut();

Contributing

How to contribute

License

MIT

Security issues

If you found a security issue please contact directly by mail instead of using the issue tracker at codecollab-security@pieterhordijk.com

统计信息

  • 总下载量: 53
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: See
  • 更新时间: 2015-08-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固