本文整理汇总了PHP中Registration::generateSalt方法的典型用法代码示例。如果您正苦于以下问题:PHP Registration::generateSalt方法的具体用法?PHP Registration::generateSalt怎么用?PHP Registration::generateSalt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registration
的用法示例。
在下文中一共展示了Registration::generateSalt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resetpassword
function resetpassword()
{
$userId = Users::getUserIdByCode($_POST["txtCode"]);
if ($userId != -1) {
$date = Users::getCodeDate($_POST["txtCode"]);
$date = strtotime($date) + 600;
if (strtotime(date("Y-m-d H:i:s")) <= $date) {
if ($_POST["txtPassword"] == $_POST["txtPasswordConfirm"]) {
$salt = Registration::generateSalt();
$crypt = crypt($_POST["txtPassword"], $salt);
Users::updatePassword($userId, $crypt, $salt);
Users::deleteCode($userId);
header(CONNECTION_HEADER);
}
} else {
Users::deleteCode($userId);
$data = array("Forgot" => true);
$this->renderTemplate(file_get_contents(RESET_PAGE), $data);
}
} else {
Users::deleteCode($userId);
$data = array("Forgot" => true);
$this->renderTemplate(file_get_contents(RESET_PAGE), $data);
}
}
示例2: updatePassword
function updatePassword()
{
if (isset($_POST["UserId"])) {
$salt = Registration::generateSalt();
$crypt = crypt($_POST["Password"], $salt);
Users::updatePassword($_POST["UserId"], $crypt, $salt);
}
}
示例3: addFamilyMember
function addFamilyMember()
{
if (isset($_POST["UserName"]) && isset($_POST["UserPass"]) && isset($_POST["UserInfoTel"]) && isset($_POST["UserInfoFirstName"]) && isset($_POST["UserInfoLastName"])) {
if (Users::isUserExistByMail($_POST["UserName"])) {
echo json_encode(array("errors" => array("L'adresse de courriel que vous avez fournie est déjà utilisé")));
} else {
$salt = Registration::generateSalt();
$crypt = crypt($_POST["UserPass"], $salt);
$ownerId = Users::getFamilyOwnerByUserId($_SESSION["id"]);
Users::addUser($_POST["UserName"], $_POST["UserInfoTel"], $_POST["UserInfoFirstName"], $_POST["UserInfoLastName"], $ownerId[0][0], $crypt, $salt);
$userId = Users::getUserIdByName($_POST["UserName"]);
$user = Users::getUser($userId);
$phoneNumber = $user["UserInfoTel"];
$phoneNumber = Registration::normalizePhoneNumber($phoneNumber);
$user["UserInfoTel"] = $phoneNumber[0] . " (" . mb_substr($phoneNumber, 1, 3) . ") " . mb_substr($phoneNumber, 4, 3) . "-" . mb_substr($phoneNumber, 7, 4);
echo json_encode($user);
}
}
}
示例4: editFamilyAdmin
/**
* Éditer un administrateur de patrimoine
*
* TODO: Message d'erreur si l'opération échoue (transmis par un callback au client qui a envoyé la requête)
*/
function editFamilyAdmin()
{
if (isset($_POST["UserId"])) {
if (isset($_POST["UserName"])) {
Users::updateUserName($_POST["UserId"], $_POST["UserName"]);
}
if (isset($_POST["UserInfoFirstName"])) {
Users::updateFirstName($_POST["UserId"], $_POST["UserInfoFirstName"]);
}
if (isset($_POST["UserInfoLastName"])) {
Users::updateLastName($_POST["UserId"], $_POST["UserInfoLastName"]);
}
if (isset($_POST["UserInfoTel"])) {
$phone = Registration::normalizePhoneNumber($_POST["UserInfoTel"]);
Users::updateTel($_POST["UserId"], $phone);
}
if (isset($_POST["UserPass"])) {
if (!empty($_POST["UserPass"])) {
$salt = Registration::generateSalt();
$crypt = crypt($_POST["UserPass"], $salt);
Users::updatePassword($_POST["UserId"], $crypt, $salt);
}
}
}
}