定制 vojtasvoboda/oc-codelogin-plugin 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

vojtasvoboda/oc-codelogin-plugin

Composer 安装命令:

composer require vojtasvoboda/oc-codelogin-plugin

包简介

Code login plugin for OctoberCMS

README 文档

README

Codacy Scrutinizer Coverage License

Login only by code or password. Create secret page or protect whole site just in minute. Tested with the latest stable OctoberCMS build 349.

Dependencies

RainLab.User plugin for users management.

How to create secret page

  1. Install RainLab.User plugin and then VojtaSvoboda.CodeLogin plugin.

  2. Insert RainLab.User Session component to layout which you want to protect by code.

Screenshot of Session component placed at layout

Set Allow property only for Users (means logged users) and then set your login page. All guests will be redirect to login page.

Be sure you have injected JavaScript code and jQuery to your layout:

<script src="{{ [
    'assets/javascript/jquery.js',
]|theme }}"></script>

{% framework %}
{% framework extras %}

Framework extras tag is optional and this tag adds a CSS and JavaScript files that contain the loading indicator plugin and CSS classes for styling the loading indicator. The indicator is displayed on the top of the page when an AJAX request runs.

  1. Create login page with Login layout and insert RainLab.User Session component and Code login form. Session component set to Allow only guest (login allowed only for guests). CodeLogin provide login form and session component will redirect user when already logged.

Screenshot of Login page with Session and Code login form

Set redirect parameter to your secret page and then set if you want to use input type text or input type password (code will not be visible).

Screenshot of Login form with visible password

  1. Use default HTML or create own design by extending component template:
  • create file /partials/codeLogin/default.htm
  • copy content from original component template /components/codelogin/default.htm
  • add classes or HTML you needed

Screenshot of custom designs

  1. At RainLab.User plugin create as many users as you want. It's recommanded to use unique password for each user, because first user with matched password will be log!

  2. [optional] If you want create logout page, just create logout.htm, insert session component allowed for logged user and with redirect to login page. To the template paste this code:

<a data-request="onLogout" class="btn" data-request-data="redirect: '/login'">Sign out</a>

  1. [optional] For logging all user accesses use UserAccessLog plugin.

  2. [optional] For creating more user accounts use User import/export plugin - just create simple XLS file with usernames and import it (passwords can be generated by Norton Password Generator).

Events

After successfull login you can use rainlab.user.login event to catch logged user instance:

Event::listen('rainlab.user.login', function ($user) {
    dump($user);
});

Troubleshooting

Login button doesn't works.

Be sure you have included jQuery and {% framework extras %} code to your layout (not to page).

AJAX handler 'codeLogin::onCodesignin' was not found.

If form doesn't work, try to insert Code login component to page, not to partial. Login component should be placed beside to Session component.

Future plans

  • can change login form input field text
  • code preset with GET parameter e.g. /login?code=abcde
  • unit test for logging method

Feel free to send pullrequest!

License

Code login plugin is open-sourced software licensed under the MIT license same as OctoberCMS platform.

Contributing

Please send Pull Request to master branch.

vojtasvoboda/oc-codelogin-plugin 适用场景与选型建议

vojtasvoboda/oc-codelogin-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 8, 最近一次更新时间为 2016 年 07 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「plugin」 「user」 「code」 「login」 「october」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 vojtasvoboda/oc-codelogin-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 vojtasvoboda/oc-codelogin-plugin 我们能提供哪些服务?
定制开发 / 二次开发

基于 vojtasvoboda/oc-codelogin-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 8
  • Watchers: 2
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-07-14