mirror of
https://github.com/delight-im/PHP-Auth.git
synced 2025-08-08 09:06:29 +02:00
Add tests for method 'reconfirmPassword' from class 'Auth'
This commit is contained in:
@@ -203,6 +203,14 @@ function processRequestData(\Delight\Auth\Auth $auth) {
|
|||||||
return 'too many requests';
|
return 'too many requests';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ($_POST['action'] === 'reconfirmPassword') {
|
||||||
|
try {
|
||||||
|
return $auth->reconfirmPassword($_POST['password']) ? 'correct' : 'wrong';
|
||||||
|
}
|
||||||
|
catch (\Delight\Auth\NotLoggedInException $e) {
|
||||||
|
return 'not logged in';
|
||||||
|
}
|
||||||
|
}
|
||||||
else if ($_POST['action'] === 'changePassword') {
|
else if ($_POST['action'] === 'changePassword') {
|
||||||
try {
|
try {
|
||||||
$auth->changePassword($_POST['oldPassword'], $_POST['newPassword']);
|
$auth->changePassword($_POST['oldPassword'], $_POST['newPassword']);
|
||||||
@@ -483,6 +491,12 @@ function showGeneralForm() {
|
|||||||
function showAuthenticatedUserForm() {
|
function showAuthenticatedUserForm() {
|
||||||
showGeneralForm();
|
showGeneralForm();
|
||||||
|
|
||||||
|
echo '<form action="" method="post" accept-charset="utf-8">';
|
||||||
|
echo '<input type="hidden" name="action" value="reconfirmPassword" />';
|
||||||
|
echo '<input type="text" name="password" placeholder="Password" /> ';
|
||||||
|
echo '<button type="submit">Reconfirm password</button>';
|
||||||
|
echo '</form>';
|
||||||
|
|
||||||
echo '<form action="" method="post" accept-charset="utf-8">';
|
echo '<form action="" method="post" accept-charset="utf-8">';
|
||||||
echo '<input type="hidden" name="action" value="changePassword" />';
|
echo '<input type="hidden" name="action" value="changePassword" />';
|
||||||
echo '<input type="text" name="oldPassword" placeholder="Old password" /> ';
|
echo '<input type="text" name="oldPassword" placeholder="Old password" /> ';
|
||||||
|
Reference in New Issue
Block a user