All Projects → atk4 → login

atk4 / login

Licence: MIT license
Add-on implementing User Login, Registration, Management and Password

Programming Languages

PHP
23972 projects - #3 most used programming language
HTML
75241 projects
Pug
443 projects
Gherkin
971 projects

Projects that are alternatives of or similar to login

core
Core Object Traits for Agile Toolkit
Stars: ✭ 19 (-20.83%)
Mutual labels:  agile, atk4
react-native-kakao-login
React Native module for kakao login sdk: rn-kakao-login
Stars: ✭ 76 (+216.67%)
Mutual labels:  login
oauth2-wechat
微信登录认证授权 Wechat login authorization. This package provides Wechat OAuth 2.0 support for the PHP League's OAuth 2.0 Client
Stars: ✭ 18 (-25%)
Mutual labels:  login
agile
🌌 Global State and Logic Library for JavaScript/Typescript applications
Stars: ✭ 90 (+275%)
Mutual labels:  agile
SpringSecurityInEasySteps
Learn Spring Security step by step
Stars: ✭ 13 (-45.83%)
Mutual labels:  login
laravel-login-links
Create (passwordless) login links for users
Stars: ✭ 13 (-45.83%)
Mutual labels:  login
lua-resty-feishu-auth
适用于 OpenResty / ngx_lua 的基于飞书组织架构的登录认证
Stars: ✭ 28 (+16.67%)
Mutual labels:  login
ReactSignupLoginComponent
The React SignupLogin Component is a drop in login/register/forgotPassword component to speed up development.
Stars: ✭ 30 (+25%)
Mutual labels:  login
customer-ajax-login
Free magento 2 extension for Popup and AJAX based Login and Sign Up | Manish Joy
Stars: ✭ 14 (-41.67%)
Mutual labels:  login
maturity-models
Maturity models for IT, Agile, DevOps, TOGAF, Six Sigma, P3M3, etc.
Stars: ✭ 157 (+554.17%)
Mutual labels:  agile
UniSpyServer
An Open source GameSpy emulator written in C#
Stars: ✭ 110 (+358.33%)
Mutual labels:  login
hummingbird
커밋할수록 자라나는 귀여운 병아리들과 꾸준한 개발습관 들이기 어플 PeepPeep
Stars: ✭ 9 (-62.5%)
Mutual labels:  agile
scrumlr.io
Webapp for collaborative online retrospectives
Stars: ✭ 116 (+383.33%)
Mutual labels:  agile
YHThirdManager
一个快速、简单、易集成、扩展性好的社交化组件。摒弃友盟等三方库,使用原生SDK。支持微信支付、微信分享、微信登录、微信授权、QQ授权、QQ分享、QQ登录、新浪授权、新浪登录、新浪分享、微博评论、微博获取、支付宝支付。极大的减小了包体积;同时加入了自动管理提示框的功能
Stars: ✭ 41 (+70.83%)
Mutual labels:  login
scrum-planning-poker
Please feel FREE to try it and give feedback by searching Scrum敏捷估算 in WeChat mini program.
Stars: ✭ 30 (+25%)
Mutual labels:  agile
egg-weapp-sdk
Egg的微信小程序登录会话管理SDK
Stars: ✭ 111 (+362.5%)
Mutual labels:  login
EasyFirebase
No description or website provided.
Stars: ✭ 48 (+100%)
Mutual labels:  login
users-service
A small microservice for managing user registrations, password changes and issue access tokens
Stars: ✭ 16 (-33.33%)
Mutual labels:  login
user-stories-applied
敏捷的用户故事方法
Stars: ✭ 33 (+37.5%)
Mutual labels:  agile
pi-eco-indicator
Display at-a-glance data of carbon intensity or Octopus Agile prices on a Pimoroni Blinkt! display or a Pimoroni Inky pHAT display.
Stars: ✭ 15 (-37.5%)
Mutual labels:  agile

ATK UI implements a high-level User Interface for Web App - such as Admin System. One of the most common things for the Admin system is a log-in screen.

Although you can implement log-in form easily, this add-on does everything for you:

Installation

Install through composer composer require atk4/login

Then add Auth into your app and set appropriate user controller:

$app = new \Atk4\Ui\App();
$app->initLayout([\Atk4\Ui\Layout\Admin::class]);
$app->db = new \Atk4\Data\Persistence($dsn);

// ADD THIS CODE:
$app->auth = new \Atk4\Login\Auth();
$app->auth->setModel(new \Atk4\Login\Model\User($app->db));

// The rest of YOUR UI code will now be protected
\Atk4\Ui\Crud::addTo($app)->setModel(new Client($app->db));

(If you do not have User model yet, you can extend or use \Atk4\Login\Model\User).

Login

Features

Here are all the classes implemented:

  • Full transparent authentication
    • Populates user menu with name of current user
    • Adds log-out link
    • Adds Preferences page
  • Flexible ACL support
  • Model\User - basic user entity that can be extended
  • LoginForm - username/password login form
  • RegisterForm - registration form
  • Auth - authentication controller, verify and record logged state
  • UserAdmin - UI for user administration
  • Layout\Narrow - SemanticUI-based narrow responsive layout login/registration forms
  • Templates for forms an messages
  • Demos for all of the above

When used default installation, it will relay on various other components (such as LoginForm), however you can also use those components individually.

Advanced Usage

There are two modes of operation - Automated and Manual. Automated handles display of forms based on currently logged state automatically. It was already presented in the "Installation" section above.

For a more advanced usage, you can either tweak Automated mode or use individual components manually.

Tweaking Automated Mode

When you initialize 'Auth' class you may inject property values:

$app->auth = new \Atk4\Login\Auth([
    'hasPreferences' => false, // do not show Preferences page/form
    'pageDashboard' => 'dashboard', // name of the page, where user arrives after login
    'pageExit' => 'goodbye', // where to send user after logout

    // Oter options:
    // 'hasUserMenu' => false,  // will disable interaction with Admin Layout user menu
]);
$app->auth->setModel(new User($app->db));

Using Manual Mode

In the manual mode, no checks will be performed, and you are responsible for authenticating user yourself. This works best if you have a more complex auth logic.

$app->auth = new \Atk4\Login\Auth([
    'check' => false,
]);
$app->auth->setModel(new User($app->db));


// Now manually use login logic
if (!$app->auth->user->isLoaded()) {
    \Atk4\Login\LoginForm::addTo($app, ['auth' => $app->auth]);
}

Adding sign-up form

\Atk4\Login\RegisterForm::addTo($app)
    ->setModel(new \Atk4\Login\Model\User($app->db));

Displays email and 2 password fields (for confirmation). If filled successfully will create new record for \Atk4\Login\Model\User. Will cast email to lowercase before adding. Things to try:

  • Extend or use your own User class
  • Add more fields to registration form
  • Decorate registration form with message and links
  • Use multi-column form layout

Log-in form

Login

\Atk4\Login\LoginForm::addTo($app, [
  'auth'=>$app->auth,
  //'successLink'=>['dashboard'],
  //'forgotLink'=>['forgot'],
]);

Displays log-in form and associate it with $auth. When form is filled, will attempt to authenticate using $auth's model. If password is typed correctly, will redirect to "successLink" (which will be passed to $app->url()). Things to try:

  • Redirect to login page if not authenticated
  • Add 3rd party authentication (authenticate using 3rd party lib, look up connected account, store into auth persistence)
  • Implement two factor authentication (store flag in auth persistence indicating if 2nd factor is carried out, if not display it)
  • Implement password verification delay after several unsuccessful attempts
  • Ask user to change password if it is about to expire

Dashboard

To check if user is currently logged in:

if ($app->auth->user->isLoaded()) {
  // logged-in
}

Auth model stores user model data in session, so if you delete user from database, he will not be automatically logged out. To log-out user explicitly, call $app->auth->logout().

You may also access user data like this: $app->auth->model['name']; Things to try:

  • Explicitly load user record from database instead of cache only
  • Store last login / last access time in database
  • Move auth cache to MemCache

Profile Form

This form would allow user to change user data (including password) but only if user is authenticated. To implement profile form use:

Form::addTo($app)->setModel($app->auth->user);

Demos open profile form in a pop-up window, if you wish to do it, you can use this code:

Button::addTo($app, ['Profile', 'class.primary' => true])->on('click', Modal::addTo($app)->set(function ($p) {
    Form::addTo($p)->setModel($p->app->auth->user);
})->show());

Things to try:

  • Ask user to verify old password before changing settings
  • Send SMS notification / email if any user setting has bees changed
  • Store user settings in multiple tables (join)

Password

Field 'password' is using a custom field class Password. Stored value is always a hash, use Password::hashPassword() + Password::set() methods to set the value or use Password::setPassword() method to set the password directly. You can use this field in any model like this:

$model->addField('password', [\Atk4\Data\Field\PasswordField::class]);

Also the password will not be stored in session cache and will not be accessible directly.

Things to try:

  • Add complexity validation
  • Add password recovery form
  • use CAPCHA when recovering password

Custom User Model

Although a basic User model is supplied, you can either extend it or use your own user model.

User Admin

We include a slightly extended "Admin" interface which includes page to see user details and change their password. To create admin page use:

\Atk4\Login\UserAdmin::addTo($app)
    ->setModel(new \Atk4\Login\Model\User($app->db));

Login

This uses a standard CRUD interface, enhancing it with additional actions:

  • key button allows to change user password and offers random password generator. Uses "input" field for a visible password. You can also use regular "edit" button which will contain asterisk-protected field for the password.
  • eye button is designed to show user details, such as which group he belongs to. Currently this panel and groups are not implemented.

Login

Things to try:

  • Add additional information on details modal.
  • Add audit log for user actions (login, change password etc)

Migrations

Use of migration is optional, but can help by populating initial structure of your user model. Look inside file demos/wizard.php. It simply adds a console component, which will execute migration of 'User' model.

When migration is executed it simply checks to make sure that table for 'user' exists and has all required fields. It will not delete or change existing fields or tables.

Roadmap

Generally we wish to keep this add-on clean, but very extensible, with various tutorials on how to implement various scenarios (noted above under "Things to try").

For some of those features we would like to add a better support in next releases:

  • [1.0] - add "$auth->check()" - for Automated authentication checks
  • [1.1] - add Password Reminder form and tutorial on integration with Email / SMS sending
  • [1.2] - add Password strength verification (and indicator)

If you would like to propose other features, please suggest them by opening ticket here:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].