Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • ActivateOperation
  • AvailableSitesBlock
  • ConfigBlock
  • ConfigOperation
  • DeactivateOperation
  • DeleteBlock
  • DeleteOperation
  • EditBlock
  • Hooks
  • IsUniqueOperation
  • LoginComboElement
  • LoginForm
  • LoginOperation
  • LogoutOperation
  • ManageBlock
  • Model
  • Module
  • OwnershipResolver
  • PermissionResolver
  • ProfileController
  • QueryOperationOperation
  • SaveOperation
  • UnlockLoginOperation
  • Update20131021
  • User
  • ViewProvider

Interfaces

  • OwnershipResolverInterface
  • PermissionResolverInterface

Traits

  • LoggedAtProperty

Exceptions

  • WebsiteAdminNotAccessible
 1 <?php
 2 
 3 /*
 4  * This file is part of the Icybee package.
 5  *
 6  * (c) Olivier Laviale <olivier.laviale@gmail.com>
 7  *
 8  * For the full copyright and license information, please view the LICENSE
 9  * file that was distributed with this source code.
10  */
11 
12 namespace Icybee\Modules\Users;
13 
14 /**
15  * Unlocks login locked after multiple failed login attempts.
16  *
17  * - username (string) Username of the locked account.
18  * - token (string) Token to unlock the account.
19  * - continue (string)[optional] Destination of the operation successful process. Default to '/'.
20  */
21 class UnlockLoginOperation extends \ICanBoogie\Operation
22 {
23     protected function lazy_get_record()
24     {
25         $username = $this->request['username'];
26 
27         return $this->module->model->where('username = ? OR email = ?', $username, $username)->one;
28     }
29 
30     protected function validate(\ICanboogie\Errors $errors)
31     {
32         global $core;
33 
34         $token = $this->request['token'];
35 
36         if (!$this->request['username'] || !$token)
37         {
38             return false;
39         }
40 
41         $user = $this->record;
42 
43         if (!$user)
44         {
45             throw new \Exception('Unknown user');
46         }
47 
48         if ($user->metas['login_unlock_token'] != $token)
49         {
50             throw new \Exception('Invalid token.');
51         }
52 
53         return true;
54     }
55 
56     protected function process()
57     {
58         global $core;
59 
60         $user = $this->record;
61 
62         $user->metas['login_unlock_token'] = null;
63         $user->metas['login_unlock_time'] = null;
64         $user->metas['failed_login_count'] = 0;
65 
66         $this->response->message = 'Login has been unlocked';
67         $this->response->location = isset($this->request['continue']) ? $this->request['continue'] : '/';
68 
69         return true;
70     }
71 }
Autodoc API documentation generated by ApiGen 2.8.0