本文整理汇总了PHP中Password::propertyIsValid方法的典型用法代码示例。如果您正苦于以下问题:PHP Password::propertyIsValid方法的具体用法?PHP Password::propertyIsValid怎么用?PHP Password::propertyIsValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Password
的用法示例。
在下文中一共展示了Password::propertyIsValid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isValid
public static function isValid(&$properties_dictionary, $limit_to_keys, &$error)
{
// Check each property is valid
//
if (!parent::isValid($properties_dictionary, $limit_to_keys, $error)) {
return false;
}
if (ValidationC::should_test_property('rawEmail', $properties_dictionary, true, $limit_to_keys) && !Email::propertyIsValid('rawEmail', $properties_dictionary[USER_KEY_EMAIL], $error)) {
// Email was not valid
//
return false;
}
if (ValidationC::should_test_property('rawPassword', $properties_dictionary, true, $limit_to_keys) && !Password::propertyIsValid('rawPassword', $properties_dictionary[USER_KEY_PASSWORD], $error)) {
// Password was not valid
//
return false;
}
if (isset($properties_dictionary[USER_KEY_NOTIFICATION_DEVICE_IDENTIFIERS])) {
if (ValidationC::should_test_property(USER_KEY_NOTIFICATION_DEVICE_IDENTIFIERS, $properties_dictionary, true, $limit_to_keys) && !User::propertyIsValid(USER_KEY_NOTIFICATION_DEVICE_IDENTIFIERS, $properties_dictionary[USER_KEY_NOTIFICATION_DEVICE_IDENTIFIERS], $error)) {
// Password was not valid
//
return false;
}
}
return true;
}
示例2: isValid
public static function isValid(&$properties_dictionary, $limit_to_keys, &$error)
{
// Check each property is valid
//
if (ValidationC::should_test_property('rawPassword', $properties_dictionary, true, $limit_to_keys) && !Password::propertyIsValid('rawPassword', $properties_dictionary['rawPassword'], $error)) {
// Password was not valid
//
return false;
}
return true;
}
示例3: update
public static function update(Inputter $inputter, JSONOutputter $outputter)
{
// Update
//
// 1) Test all data is available and valid
//
$required_dictionary = array(UNIVERSALLY_UNIQUE_OBJECT_KEY_IDENTIFICATION => '');
$optional_dictionary = array(USER_KEY_EMAIL => null, USER_KEY_PASSWORD => null, 'notificationDeviceIdentifiersToRemove' => array(), 'notificationDeviceIdentifiersToAdd' => array(), USER_KEY_NOTIFICATION_DEVICE_IDENTIFIERS => array(), UNIVERSALLY_UNIQUE_OBJECT_KEY_DATE_UPDATED => date('c'), CREATINGUSER_KEY_FIRST_NAME => null, CREATINGUSER_KEY_SURNAME => null, CREATINGUSER_KEY_NAME => null, CREATINGUSER_KEY_GENDER => null);
$inputter->validate_input($required_dictionary, $optional_dictionary);
// Remove things that shouldn't be updated
//
if (isset($inputter->variables_array[UNIVERSALLY_UNIQUE_OBJECT_KEY_DATE_CREATED])) {
unset($inputter->variables_array[UNIVERSALLY_UNIQUE_OBJECT_KEY_DATE_CREATED]);
}
// Valid
//
$update_error = null;
// Email
//
if (isset($inputter->variables_array[USER_KEY_EMAIL])) {
Email::propertyIsValid('rawEmail', $inputter->variables_array[USER_KEY_EMAIL], $update_error);
}
// Password
//
if (isset($inputter->variables_array[USER_KEY_PASSWORD])) {
Password::propertyIsValid('rawPassword', $inputter->variables_array[USER_KEY_PASSWORD], $update_error);
}
// Notification device identifiers
//
if (isset($inputter->variables_array[USER_KEY_NOTIFICATION_DEVICE_IDENTIFIERS])) {
User::propertyIsValid(USER_KEY_NOTIFICATION_DEVICE_IDENTIFIERS, $inputter->variables_array[USER_KEY_NOTIFICATION_DEVICE_IDENTIFIERS], $update_error);
}
if (isset($inputter->variables_array['notificationDeviceIdentifiersToRemove'])) {
User::propertyIsValid(USER_KEY_NOTIFICATION_DEVICE_IDENTIFIERS, $inputter->variables_array['notificationDeviceIdentifiersToRemove'], $update_error);
}
if (isset($inputter->variables_array['notificationDeviceIdentifiersToAdd'])) {
User::propertyIsValid(USER_KEY_NOTIFICATION_DEVICE_IDENTIFIERS, $inputter->variables_array['notificationDeviceIdentifiersToAdd'], $update_error);
}
// Creating user
//
if (isset($inputter->variables_array[CREATINGUSER_KEY_FIRST_NAME]) || isset($inputter->variables_array[CREATINGUSER_KEY_SURNAME]) || isset($inputter->variables_array[CREATINGUSER_KEY_NAME])) {
CreatingUser::isValid(array(CREATINGUSER_KEY_FIRST_NAME => $inputter->variables_array[CREATINGUSER_KEY_FIRST_NAME], CREATINGUSER_KEY_SURNAME => $inputter->variables_array[CREATINGUSER_KEY_SURNAME], CREATINGUSER_KEY_NAME => $inputter->variables_array[CREATINGUSER_KEY_NAME], CREATINGUSER_KEY_GENDER => $inputter->variables_array[CREATINGUSER_KEY_GENDER]), true, $update_error);
}
if (isset($update_error)) {
$outputter->print_error($update_error);
return;
}
// 2) Get user
//
// User might exist (check against ID)
//
// Create query
//
$client = new Everyman\Neo4j\Client('events.sb04.stations.graphenedb.com', 24789);
$client->getTransport()->setAuth('Events', '3TP9LHROhv8LIcGmbYzq');
$query_string_get_user = 'MATCH (user:User) ' . 'WHERE user.' . UNIVERSALLY_UNIQUE_OBJECT_KEY_IDENTIFICATION . " = '" . $inputter->variables_array[UNIVERSALLY_UNIQUE_OBJECT_KEY_IDENTIFICATION] . "'" . 'RETURN user';
$query_get_user = new Everyman\Neo4j\Cypher\Query($client, $query_string_get_user);
$result_get_user = $query_get_user->getResultSet();
if ($result_get_user->count() < 1) {
// No users exist
//
$error = Error::withDomain(PRIVATE_EVENTS_REST_CONTROLLER_ERROR_DOMAIN, PRIVATE_EVENTS_REST_CONTROLLER_ERROR_CODE_ENTITY_DOES_NOT_EXIST, 'A user with the identification ' . $inputter->variables_array[UNIVERSALLY_UNIQUE_IDENTIFIER_KEY_IDENTIFICATION] . " doesn\\'t exist.");
$outputter->print_error($error);
}
// 3) Update the user
//
// Existing properties
//
$account_to_update = $result_get_user[0]['user'];
$account_to_update->setProperty(UNIVERSALLY_UNIQUE_OBJECT_KEY_DATE_UPDATED, date('c'));
if (isset($inputter->variables_array[USER_KEY_EMAIL])) {
$account_to_update->setProperty(USER_KEY_EMAIL, $inputter->variables_array[USER_KEY_EMAIL]);
}
if (isset($inputter->variables_array[USER_KEY_PASSWORD])) {
$account_to_update->setProperty(USER_KEY_PASSWORD, $inputter->variables_array[USER_KEY_PASSWORD]);
}
// Identifiers
//
$existing = $account_to_update->getProperty(USER_KEY_NOTIFICATION_DEVICE_IDENTIFIERS);
$new = array();
if (isset($inputter->variables_array[USER_KEY_NOTIFICATION_DEVICE_IDENTIFIERS])) {
$new = $inputter->variables_array[USER_KEY_NOTIFICATION_DEVICE_IDENTIFIERS];
}
if (isset($existing) && is_array($existing)) {
// Merge
//
$new = array_merge($new, $existing);
}
$new = array_unique($new);
// Add
//
if (isset($inputter->variables_array['notificationDeviceIdentifiersToAdd']) && is_array($inputter->variables_array['notificationDeviceIdentifiersToAdd'])) {
$new = array_merge($new, $inputter->variables_array['notificationDeviceIdentifiersToAdd']);
$new = array_unique($new);
}
// Remove
//
if (isset($inputter->variables_array['notificationDeviceIdentifiersToRemove']) && is_array($inputter->variables_array['notificationDeviceIdentifiersToRemove'])) {
$new = array_diff($new, $inputter->variables_array['notificationDeviceIdentifiersToRemove']);
$new = array_unique($new);
//.........这里部分代码省略.........