本文整理汇总了PHP中changePassword函数的典型用法代码示例。如果您正苦于以下问题:PHP changePassword函数的具体用法?PHP changePassword怎么用?PHP changePassword使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了changePassword函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lostPassword
function lostPassword($username, $email)
{
$randomPassword = generate_code(10);
if (changePassword($username, $randomPassword, $randomPassword)) {
if (sendLostPasswordEmail($username, $email, $randomPassword)) {
return true;
}
}
return false;
}
示例2: doAction
public function doAction()
{
$changePass = changePassword('prj', $this->id_project, $this->old_password, $this->new_password);
if ($changePass <= 0) {
$this->api_output['message'] = 'Wrong id or pass';
return -1;
//FAIL
}
$this->api_output['status'] = 'OK';
$this->api_output['id_project'] = $this->id_project;
$this->api_output['project_pass'] = $this->new_password;
}
示例3: doAction
public function doAction()
{
if (!$this->userIsLogged) {
throw new Exception('User not Logged');
}
if ($this->undo) {
$new_pwd = $this->old_password;
$actual_pwd = $this->password;
} else {
$new_pwd = CatUtils::generate_password();
$actual_pwd = $this->password;
}
changePassword($this->res_type, $this->res_id, $actual_pwd, $new_pwd);
$this->result['password'] = $new_pwd;
$this->result['undo'] = $this->password;
}
示例4: post_handler
public function post_handler()
{
$this->changed = false;
$old = FormLib::get('oldpass');
$new1 = FormLib::get('newpass1');
$new2 = FormLib::get('newpass2');
if ($new1 != $new2) {
$this->add_onload_command("showBootstrapAlert('#alert-area', 'danger', 'New passwords do not match');\n");
return true;
}
$this->changed = changePassword($this->current_user, $old, $new1);
if (!$this->changed) {
$this->add_onload_command("showBootstrapAlert('#alert-area', 'danger', 'Password change failed. Ensure old password is correct');\n");
}
return true;
}
示例5: changeForm
function changeForm() {
// jeżeli wcisnięty został przycisk "zmień"
if (isset($_POST['changepassword'])) {
$newPassword = clearVariable($_POST['newpassword']);
$repeatPassword = clearVariable($_POST['repeatpassword']);
$oldPassword = clearVariable($_POST['oldpassword']);
$changeStatus;
if (empty($newPassword) || empty($repeatPassword) || empty($oldPassword)) {
// zwrócenie błędu jeżeli któreś pole jest puste
$changeStatus = "<p>Musisz wpisać login i hasło.</p>";
} else if ($newPassword != $repeatPassword) {
$changeStatus = "<p>Nowe hasło i powtórzone hasło są różne.</p>";
} else {
include('php/changepassword.php');
$changeStatus = changePassword($oldPassword, $newPassword);
}
echo $changeStatus;
}
?>
<form action="?category=account&action=changepassword" method="post">
<table>
<tr>
<td>Nowe hasło:</td>
<td><input id="Password1" type="password" maxlength="16" size="16" name="newpassword" /></td>
</tr>
<tr>
<td>Powtórz:</td>
<td><input id="Password1" type="password" maxlength="16" size="16" name="repeatpassword" /></td>
</tr>
<tr>
<td>Stare hasło:</td>
<td><input id="Password1" type="password" maxlength="16" size="16" name="oldpassword" /></td>
</tr colspan="2">
<td><input id="Submit1" type="submit" name="changepassword" value="Zmień" /></td>
</table>
</form>
<?php
}
示例6: executeModification
/**
* Überprüft, ob das angegebene Passwort korrekt ist. Wenn dem so ist,
* wird je nachdem, welche Daten vorhanden sind, das Passwort und/oder
* die E-Mail-Adresse modifiziert.
*/
function executeModification()
{
// Passwort überpruefen
if (!isset($_POST['currentPassword'])) {
throw new Exception('Bitte geben Sie Ihr Passwort an.');
}
$verified = verifyPassword();
if (!$verified) {
throw new Exception('Bitte geben Sie ihr korrektes Passwort an.');
}
$success = true;
$userid = $_SESSION['userid'];
// überpruefen, was geändert werden soll
$changePassword = isset($_POST['newPassword']) && $_POST['newPassword'] != '' && (isset($_POST['newPasswordRepeat']) && $_POST['newPasswordRepeat'] != '');
$changeEmail = isset($_POST['newEmail']) && $_POST['newEmail'] != '' && (isset($_POST['newEmailRepeat']) && $_POST['newEmailRepeat'] != '');
if ($changePassword) {
$success &= changePassword();
}
if ($changeEmail) {
$success &= changeEmail();
}
if ($success) {
if ($changeEmail && $changePassword) {
echo "Ihre E-Mail-Adresse und Ihr Passwort wurden erfolgreich geändert.";
} else {
if ($changeEmail && !$changePassword) {
echo "Ihre E-Mail-Adresse wurde erfolgreich geändert.";
} else {
if (!$changeEmail && $changePassword) {
echo "Ihr Passwort wurde erfolgreich geändert.";
}
}
}
} else {
throw new Exception();
}
}
示例7: session_start
<?php
include "../util/DbUtil.php";
session_start();
$password = mysql_real_escape_string($_POST['password']);
$passwordConf = mysql_real_escape_string($_POST['passwordConf']);
$securityQuestionAnswer = mysql_real_escape_string($_POST['securityQuestionAnswer']);
$response = "test";
$changeSecurityQuestion = isset($_POST['securityQuestion']);
if ($changeSecurityQuestion && $_POST['securityQuestion'] === "") {
$response = "Must choose security question";
} elseif ($password != $passwordConf) {
$response = "passwords must match";
} elseif ($securityQuestionAnswer == "") {
$response = "No security question answer supplied";
} else {
$db_conn = getConnectedDb();
if (is_null($db_conn)) {
$response = "Error connecting to database. Try again later.";
} elseif (!securityQuestionAnswerCorrect($db_conn, $securityQuestionAnswer, $_SESSION['userid'])) {
$response = "Supplied answer is incorrect.";
} elseif ($changeSecurityQuestion && !changeSecurityQuestion($db_conn, $_SESSION['userid'], $_POST['securityQuestion'])) {
$response = "Security question change failed. No password change made.";
} elseif (!changePassword($db_conn, $_SESSION['userid'], $password)) {
$response = "Failed to change password for unknown reason.";
} else {
$response = "success";
}
}
echo $response;
示例8: lang
} else {
if (updateTitle($userId, $title)) {
$successes[] = lang("ACCOUNT_TITLE_UPDATED", array($displayname, $title));
} else {
$errors[] = lang("SQL_ERROR");
}
}
}
//Update password
if (isset($_POST['password'])) {
$password = trim($_POST['password']);
//Validate password
if (minMaxRange(1, 50, $password)) {
$errors[] = lang("ACCOUNT_PASS_CHAR_LIMIT", array(1, 50));
} else {
if (changePassword($userId, $password)) {
$successes[] = lang("ACCOUNT_PASS_UPDATED", array($displayname, $password));
} else {
$errors[] = lang("SQL_ERROR");
}
}
}
//Remove permission level
if (!empty($_POST['removePermission'])) {
$remove = $_POST['removePermission'];
if ($deletion_count = removePermission($remove, $userId)) {
$successes[] = lang("ACCOUNT_PERMISSION_REMOVED", array($deletion_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
示例9: switch
$op->user_feedback = null;
$op->status = tl::OK;
$doUpdate = false;
switch ($args->doAction) {
case 'editUser':
$doUpdate = true;
foreach ($args->user as $key => $value) {
$user->{$key} = $value;
}
$op->status = tl::OK;
$op->auditMsg = "audit_user_saved";
$op->user_feedback = lang_get('result_user_changed');
$gui->update_title_bar = 1;
break;
case 'changePassword':
$op = changePassword($args, $user);
$doUpdate = $op->status >= tl::OK;
break;
case 'genAPIKey':
$op = generateAPIKey($args, $user);
break;
}
if ($doUpdate) {
$op->status = $user->writeToDB($db);
if ($op->status >= tl::OK) {
logAuditEvent(TLS($op->auditMsg, $user->login), "SAVE", $user->dbID, "users");
$_SESSION['currentUser'] = $user;
setUserSession($db, $user->login, $args->userID, $user->globalRoleID, $user->emailAddress, $user->locale);
}
}
$gui->loginHistory = new stdClass();
示例10: deleteFile
//Delete URL pattern: controller.php?operation=delete&fileName=???
} else {
if ('delete' == $operation) {
deleteFile($_POST['fileName'], getCurrentPath());
//Rename URL pattern: controller.php?operation=rename&originalFileName=???&newFileName=???
} else {
if ('rename' == $operation) {
renameFile($_POST['originalFileName'], $_POST['newFileName'], getCurrentPath());
//New Folder URL pattern: controller.php?operation=newFolder$folderName=???
} else {
if ('newFolder' == $operation) {
newFolder($_POST['folderName'], getCurrentPath());
//Change Readonly Password URL patterm: controller.php?operation=changePassword&oldPassword=???&newPassword=???
} else {
if ('changePassword' == $operation) {
changePassword($_POST['oldPassword'], $_POST['newPassword']);
}
}
}
}
}
}
}
}
}
}
} else {
setcookie('token', 'Time out', time() - 3600);
}
//Download URL pattern: controller.php?operation=download&fileName=???
if ('download' == @$_GET['operation']) {
示例11: dirname
/*
* Created on 17-okt-2011
* author Paul Wolbers
*/
$current_path = dirname(realpath(__FILE__));
require_once '../include/default.inc.php';
if (isset($_GET['action'])) {
switch ($_GET['action']) {
case 'reset':
forgottenPassword();
break;
case 'activate':
activate();
break;
case 'change_password':
changePassword();
break;
}
} else {
$letters = 'ABCDEFGHKLMNPRSTUVWYZ';
$_SESSION['cptch'] = rand(10, 99) . substr($letters, rand(1, 20), 1) . substr($letters, rand(1, 20), 1) . rand(10, 99);
$_SESSION['c_s_id'] = md5($_SESSION['cptch']);
$obj_smarty->display(FULLCAL_DIR . '/forgotten-password/index.tpl');
//header('location:'.FULLCAL_DIR.'/get-the-app-and-register');
exit;
}
function forgottenPassword()
{
global $error;
global $obj_smarty;
$use_captcha = true;
示例12: __
echo '</div>';
echo '<div class="tagline">';
echo '<div class="memberInfoHead">' . __('Your Loan History') . '</div>' . "\n";
echo '</div>';
echo showLoanHist();
echo '</div>';
echo '<div class="tagline">';
echo '<div class="memberInfoHead">' . __('Your Title Basket') . '</div><a name="biblioBasket"></a>' . "\n";
echo showBasket();
echo '</div>';
// change password only form NATIVE authentication, not for others such as LDAP
if ($sysconf['auth']['member']['method'] == 'native') {
echo '<div class="tagline">';
echo '<div class="memberInfoHead">' . __('Change Password') . '</div>' . "\n";
echo '</div>';
echo changePassword();
}
?>
<script type="text/javascript">
$(document).ready( function() {
$('.clearAll').click(function(evt) {
evt.preventDefault();
var anchor = $(this);
// get anchor href
var aHREF = anchor.attr('href');
var postData = anchor.attr('postdata');
if (confirm('Clear your title(s) basket?')) {
// send ajax
$.ajax({ type: 'POST',
url: aHREF, cache: false, data: postData, async: false,
success: function(ajaxRespond) {
示例13: strlen
<?php
$error = '';
if (isset($_POST['submit_password'])) {
if (empty($_POST['newpassword']) || empty($_POST['password2']) || !password_verify($_POST['password2'], getUserByID($_SESSION['user_id'])['password'])) {
$error = 'Password or New Password is invalid!';
} else {
$Userid = $_SESSION['user_id'];
$newpassword = $_POST['newpassword'];
$options = ['cost' => strlen($_SESSION['login_user'])];
$hashedpass = password_hash($newpassword, PASSWORD_DEFAULT, $options);
changePassword($Userid, $hashedpass);
echo '<script>window.location = "profile.php"</script>';
}
}
示例14: array
<?php
/// Copyright (c) 2004-2015, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('POST' => array('pwd' => array('string', 'default' => ''), 'prevPwd' => array('string', 'default' => '')));
require ROOT . '/library/preprocessor.php';
requireStrictRoute();
$result = false;
$isAuthToken = Setting::getUserSetting('AuthToken', false, true) ? true : false;
if ($_POST['pwd'] != '' && ($_POST['prevPwd'] != '' || $isAuthToken != false)) {
$result = changePassword(getUserId(), $_POST['pwd'], $_POST['prevPwd'], $isAuthToken);
}
if ($result) {
Respond::ResultPage(0);
} else {
Respond::ResultPage(-1);
}
示例15: session_start
<?php
session_start();
require_once '../core/init.php';
auth();
// protects this page against unauthenticated users
if (isset($_POST['save'])) {
$userId = $_SESSION['user_id'];
$prevPass = $_POST['prevPass'];
$newPass1 = $_POST['newPass1'];
$newPass2 = $_POST['newPass2'];
// use change password function to changes
$messages = changePassword($userId, $prevPass, $newPass1, $newPass2);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Change Password</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/account.css">
<link rel="stylesheet" type="text/css" href="css/animate.css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->