Skip to content
Permalink
Newer
Older
100644 21 lines (16 sloc) 564 Bytes
1
<?php
2
defined('APP_DIR') or define('APP_DIR', __DIR__ . '/../app/');
3
include_once(APP_DIR . 'controller/UserController.php');
4
include_once(APP_DIR . 'include/http.php');
5
6
$data = User::authenticated();
7
if (!$data) {
8
Http::redirect('index.html');
9
}
10
11
$info = ['username' => $data->username, 'password' => $_POST['password']];
12
$user = UserController::authenticate($info);
13
14
if (!$user) {
15
Http::redirect('account.php', ['error' => '1']);
16
}
17
18
$user->password = password_hash($_POST['new_password'], PASSWORD_DEFAULT);
19
$user->save();
20
21
Http::redirect('index.php');
You can’t perform that action at this time.