mcn / user
Provides basic user functionality
Installs: 205
Dependents: 1
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 2
Open Issues: 2
Type:module
Requires
- mcn/stdlib: dev-master
This package is not auto-updated.
Last update: 2016-03-12 08:35:09 UTC
README
Configuration
Copy the file config/mcnuser.global.php.dist
to your applications autoload directory.
Available configuration options should be documented in that file!
Authentication
Reserved result codes
Failing to comply can lead to unexpected results if you try and use other components
# The range 1 to -10 is reserved for MCNUser // Constants are from MCNUser\Authentication\Result const SUCCESS = 1; const FAILURE_IDENTITY_NOT_FOUND = -1; const FAILURE_INVALID_CREDENTIAL = -2; const FAILURE_UNCATEGORIZED = -3; const FAILURE_DISABLED_PLUGIN = -4; # The range -10 to -30 is reserved for MCN<SocialNetwork> components such as linkedIn or Facebook // Constants are from MCNLinkedIn\Authentication\Result const FAILURE_INVALID_CONFIGURATION = -11; const FAILURE_ACCESS_DENIED = -12;
Authentication events
// Constants are from MCNUser\Authentication\AuthEvent const EVENT_LOGOUT = 'logout'; const EVENT_AUTH_SUCCESS = 'authenticate.success'; const EVENT_AUTH_FAILURE = 'authenticate.failure';
Example usage could be to inject a listener to listen to the authenticate success event and check if the user has
confirmed their email account. To do this we must add a user state
property to a class that extends the
MCNUser\Entity\User
// Example listener could look like this $authenticationService->getEventManager()->attach(AuthEvent::EVENT_AUTH_SUCCESS, function(Event $e) { $user = $e->getResult()->getIdentity(); if ($user->getState() != User::STATE_CONFIRMED) { $e->stopPropagation(true); return 'Your email has not yet been confirmed'; } });