当前位置: 首页>>代码示例>>PHP>>正文


PHP account::changePassword方法代码示例

本文整理汇总了PHP中account::changePassword方法的典型用法代码示例。如果您正苦于以下问题:PHP account::changePassword方法的具体用法?PHP account::changePassword怎么用?PHP account::changePassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在account的用法示例。


在下文中一共展示了account::changePassword方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: header

if (!$account->isAuthenticated()) {
    // The user is not logged in so forward them to the login page.
    header("Location: login.php?origin=" . urlencode('account.php'));
}
if ($common->postBack()) {
    // Check that the user supplied a password matching the one currently stored in administrators.xml.
    $authenticated = $account->authenticate($_SESSION['login'], $_POST['password'], FALSE, FALSE);
    if (!$authenticated) {
        $passwordIncorrect = TRUE;
    }
    if ($_POST['password1'] != $_POST['password2']) {
        $didNotMatch = TRUE;
    }
    if ($authenticated && $_POST['password1'] == $_POST['password2']) {
        // Change the password stored in administrators.xml related to this users login.
        $account->changePassword($_SESSION['login'], $_POST['password1']);
        // Since the password has changed we will log the user out to clear older session variables.
        $account->logout();
    }
}
require_once 'includes/header.inc.php';
/////////////////////
// BEGIN HTML BODY //
if ($_SESSION['firstLogin'] && !$common->postBack()) {
    ?>
            <div id="first-login-modal" class="modal fade in" role="dialog">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-body">
                            <strong>First time login detected.</strong><br />
                            You must change the default password before continuing.
开发者ID:mgunther68,项目名称:adsb-feeder,代码行数:31,代码来源:account.php

示例2: header

        $validToken = TRUE;
        // Check the length of the password.
        $tooShort = TRUE;
        if (isset($_POST['password1']) && strlen($_POST['password1']) >= $settings::sec_length) {
            $tooShort = FALSE;
        }
        // Check that the supplied new passwords match.
        $notMatching = TRUE;
        if ($_POST['password1'] == $_POST['password2']) {
            $notMatching = FALSE;
        }
        // If everything associated with passwords is validated change the password.
        if (!$tooShort && !$notMatching) {
            // Change the password stored in administrators.xml related to this users login.
            $account->setToken($login);
            $account->changePassword($login, password_hash($_POST['password1'], PASSWORD_DEFAULT));
            header("Location: login.php");
        }
    }
}
/////////////////////
// BEGIN HTML BODY //
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" />
        <link rel="stylesheet" href="assets/css/reset.css" />
开发者ID:pinkfroot,项目名称:adsb-feeder,代码行数:31,代码来源:reset.php

示例3:

        // Check the length of the password.
        $tooShort = TRUE;
        if (isset($_POST['password1']) && strlen($_POST['password1']) >= $settings::sec_length) {
            $tooShort = FALSE;
        }
        // Check that the supplied new passwords match.
        $notMatching = TRUE;
        if ($_POST['password1'] == $_POST['password2']) {
            $notMatching = FALSE;
        }
        // Check that the supplied current password matches that which is stored.
        $authenticated = $account->authenticate($_SESSION['login'], $_POST['password'], FALSE, FALSE);
        // If everything associated with passwords is validated change the password.
        if (!$tooShort && !$notMatching && $authenticated) {
            // Change the password stored in administrators.xml related to this users login.
            $account->changePassword($_SESSION['login'], password_hash($_POST['password1'], PASSWORD_DEFAULT));
            $passwordChanged = TRUE;
        }
    }
    // If validation passed make the requested changes to the administrator account data.
    if ($nameSupplied && $validEmail) {
        $account->changeName($_SESSION['login'], $_POST['name']);
        $account->changeEmail($_SESSION['login'], $_POST['email']);
        $updated = TRUE;
    }
    // Since the password has changed we will log the user out to clear older session variables.
    if ($passwordChanged) {
        $account->logout();
    }
}
require_once 'includes/header.inc.php';
开发者ID:pinkfroot,项目名称:adsb-feeder,代码行数:31,代码来源:account.php


注:本文中的account::changePassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。