Giter Site home page Giter Site logo

cdliautogenusername's Introduction

CdliAutogenUsername

Version 0.2.1 Created by the Centre for Distance Learning and Innovation (www.cdli.ca)

Build Status

Introduction

CdliAutogenUsername is an extension to ZfcUser which provides a flexible username generator.
At it's heart is a simple, event-driven filter chain to which filter plugins are registered to perform specific actions on the username under construction. The module also contains an adapter system for interfacing with external user account systems, such as ZfcUser. It uses these adapters to ensure that every username generated is unique to the system.

Installation: ZfcUser

Main Setup

  1. Install the ZfcUser ZF2 module by cloning it into ./vendor/ and enabling it in your application.config.php file.
  2. Clone this project into your ./vendor/ directory and enable it in your application.config.php file.
  3. Copy ./vendor/CdliAutogenUsername/config/module.cdliautogenusername.local.php.dist to ./config/autoload/module.cdliautogenusername.local.php.
  4. Fill in the required configuration variable values in the file you just copied.

Activation

To have CdliAutogenUsername automatically inject a generated username when a new user account is created, paste the following snippet into the onBootstrap event of one of your Application's modules:

$serviceManager = $e->getTarget()->getServiceManager();
$zfcServiceEvents = $serviceManager->get('zfcuser_user_service')->events();
$zfcServiceEvents->attach('createFromForm', function($e) use ($serviceManager) {
    $user = $e->getParam('user');
    $generator = $serviceManager->get('CdliAutogenUsername\Generator');
    $username = $generator->generate();
    $user->setUsername($username);
));

DISCLAIMER

This code is considered proof-of-concept, and has not been vetted or tested for inclusion in a production environment. Use of this code in such environments is at your own risk.

Released under the New BSD license. See file LICENSE included with the source code for this project for a copy of the licensing terms.

cdliautogenusername's People

Contributors

adamlundrigan avatar

Watchers

James Cloos avatar Mohamed Sharaf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.