Overview

Namespaces

  • Cron
  • None

Classes

  • _HtmlGrid_TableOut
  • _TransactionModel_RawSaveOperation
  • AccessControlComponent
  • AccessControlHelper
  • ActionListHelper
  • ActiveDirectoryUtils
  • AddCurrentPidToSchedulingShellCallLogs
  • AnonymousFunctionOperation
  • ArrayUtil
  • AssociationIntegrityBehavior
  • AtomicOperation
  • AuthenticationComponent
  • AuthenticationController
  • AuthenticationUser
  • AutocompleteDatasourceComponent
  • BaseModelComponent
  • Basics
  • CakeLayersHelper
  • CheckAndRunShell
  • ClassSearcher
  • CommandLineUtil
  • CommonValidationBehavior
  • ConfigurableShellCallsSchedulingTask
  • ConfigurationKey
  • ConfigurationKeys
  • ConfigurationKeysController
  • Context
  • ContextComponent
  • ContextHelper
  • Contexts
  • ControllerInspector
  • ControllerMenuHelper
  • CreateJournalingTables
  • CreateTableConfigurationKeys
  • CreateTableSchedulingConfigurableShellCalls
  • CreateTableSchedulingShellCallLogs
  • CreateTableSettedConfigurationKeys
  • CreateTableUserResetPasswordRequests
  • CreateTableUsers
  • CronSchedulingInstaller
  • CronValidationBehavior
  • CssBox
  • CssController
  • CssProperties
  • CssShell
  • CsvUtil
  • CustomDataModel
  • DatasourceDumperManager
  • DateTimeInput
  • DependencyShell
  • DetailHelper
  • DumperShell
  • ExtendedFieldsAccessControl
  • ExtendedFieldSet
  • ExtendedFieldSetHelper
  • ExtendedFieldsParser
  • ExtendedFormHelper
  • ExtendedHasManyAppModel
  • ExtendedOperationsBehavior
  • FieldDefinition
  • FieldRowDefinition
  • FieldSetDefinition
  • FieldSetLayoutHelper
  • FileOperations
  • FileOperations_Rename
  • FileOperations_SymLink
  • FileOperations_Touch
  • FileOperations_Unlink
  • FileSystem
  • FixConfigurationKeysPrimaryKey
  • FixSettedConfigurationKeysPrimaryKey
  • HasManyUtilsBehavior
  • HtmlDocument
  • HtmlGrid
  • HtmlGrid_Cell
  • HttpClient
  • HttpResponse
  • ImapClient
  • ImapMailBox
  • ImapParserShell
  • IncludePath
  • InputMasked
  • InputSearchable
  • InputsOnSubmit
  • InstallShell
  • JenkinsBuildShell
  • Journal
  • JournalDetail
  • JournalizedBehavior
  • JsonResponseComponent
  • LayoutsHelper
  • Ldap
  • LdapUtils
  • ListFieldSet
  • ListFieldSetHelper
  • ListsHelper
  • MailParser
  • Make
  • MenuHelper
  • MigrationAllPluginsShell
  • ModelOperations
  • ModelOperations_Delete
  • ModelOperations_Save
  • ModelTraverser
  • MysqlDumper
  • OpenLdapUtils
  • PaginatorUtilComponent
  • PaginatorUtilComponentFilter
  • PaginatorUtilHelper
  • Plugin
  • PluginManager
  • Reflections
  • RenameEnabledToActiveFromUsersTable
  • RunShellCallShell
  • ScaffoldUtilComponent
  • ScaffoldUtilHelper
  • Scheduling
  • SchedulingConfigurableShellCall
  • SchedulingConfigurableShellCallsController
  • SchedulingShellCallLog
  • SchedulingShellCallLogsController
  • SettedConfigurationKey
  • StuffreposPluginsRename
  • TimeZoneBehavior
  • TransactionModel
  • TransactionOperation
  • Translator
  • TranslatorShell
  • User
  • UserAuthenticationComponent
  • UserChangePassword
  • UserResetPassword
  • UserResetPasswordRequest
  • UserResetPasswordRequestSubmission
  • UsersController
  • ViewUtilHelper

Interfaces

  • AccessControlFilter
  • CommitableOperation
  • DatasourceDumper
  • MakeListener
  • SchedulingInstaller
  • TasksObject
  • UndoableOperation

Exceptions

  • LdapObjectNotWritableException
  • ModelTraverserException
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: App::import('Model', 'LdapUser');
 4: 
 5: class UserResetPasswordRequestSubmission extends AppModel {
 6: 
 7:     var $useTable = false;
 8:     var $validate = array(
 9:         'username_or_email' => array(
10:             'notempty' => array(
11:                 'rule' => array('notempty'),
12:                 'required' => true,
13:                 'message' => 'Campo não pode ser vazio'
14:             ),
15:             'userFound' => array(
16:                 'rule' => array('userFoundValidation'),
17:                 'message' => 'Não foi encontrado um usuário com o nome de usuário ou email informado.'
18:             ),
19:             'userActive' => array(
20:                 'rule' => array('userActiveValidation'),
21:                 'message' => 'Usuário não está habilitado. Contate o administrador do sistema.'
22:             )
23:         ),
24:     );
25:     public $_schema = array(
26:         'username' => array(
27:             'type' => 'string',
28:         )
29:     );
30: 
31:     public function __construct($id = false, $table = null, $ds = null) {
32:         parent::__construct($id, $table, $ds);
33:         $this->AuthenticationUser = ClassRegistry::init('AuthenticationUser');
34:     }
35: 
36:     public function userFoundValidation($check) {
37:         return $this->getUser($check['username_or_email']) != null;
38:     }
39: 
40:     public function userActiveValidation($check) {
41:         $user = $this->getUser($check['username_or_email']);
42:         return $user && $user['AuthenticationUser']['active'];
43:     }
44: 
45:     public function getUser($usernameOrEmail = null) {
46:         if (!$usernameOrEmail) {
47:             $usernameOrEmail = $this->data[$this->alias]['username_or_email'];
48:         }
49: 
50:         $user = $this->AuthenticationUser->findByUsername(
51:                 $usernameOrEmail
52:         );
53:         if (!empty($user)) {
54:             return $user;
55:         }
56: 
57:         $user = $this->AuthenticationUser->findByEmail(
58:                 $usernameOrEmail
59:         );
60:         if (!empty($user)) {
61:             return $user;
62:         }
63: 
64:         return null;
65:     }
66: 
67:     public function getUserId() {
68:         if (($user = $this->getUser())) {
69:             return $user['User']['id'];
70:         } else {
71:             throw new Exception("Usuário não encontrado.");
72:         }
73:     }
74: 
75: }
76: 
77: ?>
78: 
API documentation generated by ApiGen 2.8.0