infotechnohelp/cakephp-users

Plugin for CakePHP 3

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Type:cakephp-plugin

dev-master 2018-09-21 14:48 UTC

This package is auto-updated.

Last update: 2022-04-17 21:28:04 UTC


README

Dependencies

Backend

  • CakePHP 3+

Frontend

  • jQuery 2+ (Required by loginForm element)
  • Vue 2+ (Required by registerForm element)

Installation

bin/cake plugin load -r Infotechnohelp/Users

bin/cake migrations migrate -p Infotechnohelp/Users

  • APP/src/Controller/AppController

class AppController extends AuthenticationController (use Infotechnohelp\Users\Controller\AuthenticationController;)

  • APP/config/bootstrap.php
Configure::write('Infotechnohelp/Users', [
    'registrationAllowed' => boolean,
    'path' => [
        'loginAction'   => '/any/path' | null,
        'loginRedirect' => '/any/path' | null,
    ],
    'message' =>[
        'loginAlert' => 'Any message' | null,
        'registrationSuccess' => 'Any message' | null,
        'registrationFailure' => 'Any message' | null,
        'confirmationLinkSent' => 'Any message' | null,
        'emailConfirmed' => 'Any message' | null,
        'emailAlreadyConfirmed' => 'Any message' | null,
        'resetPassword' => 'Any message' | null,
    ],
    'css'  => [
        'loginForm' => 'loginForm' | null, (corresponds to APP/webroot/css/loginForm.css)
        'registerForm' => 'registerForm' | null,
    ],
    'email' => [
        'fromName' => 'Any string' | null,
        'fromEmail' => 'email@email.com' | null,
        'projectUrl' => 'http://any.url.com' | null,
        'emailConfirmationSubject' => 'Any subject' | null,
        'emailConfirmationMessage' => "Hello! \n %sconfirm-email/%s \n\n %s team" | null,
    ],
]);

Defaults: (When no config added)

  • registrationAllowed → true
  • path.loginAction → APP/login
  • path.loginRedirect → APP
  • message.loginAlert → 'User cannot be identified'
  • message.registrationSuccess → 'User was successfully registered'
  • message.registrationFailure → 'An error occurred during registration'
  • css.loginForm → PLUGIN/webroot/css/loginForm.css
  • css.registerForm → PLUGIN/webroot/css/registerForm.css

Usage

Tables
  • users
  • user_email_confirmations
Connected paths

APP/login = APP/users/login

APP/logout = APP/users/logout

API layer:

APP/users/register = APP/users/api/users/register

APP/users/login = APP/users/api/users/login

APP/users/logout = APP/users/api/users/logout

Localization

Required by loginForm element

  • Username or email
  • Password
  • Login
  • Forgot your password?
  • Register
  • User cannot be identified

Required by registerForm element

  • Username
  • Email
  • Password
  • Repeat password

Messages

  • User was successfully registered
  • An error occurred during registration

Validation errors

  • Username cannot be empty
  • Username is already in use
  • Email cannot be empty
  • Email is already in use
  • Passwords do not match
  • Passwords cannot be empty