Skip to content

Commit 2d41e7c

Browse files
committed
Merge pull request #754 from bertptrs/master
Use a more secure password hash
2 parents f8b6457 + c4bacd9 commit 2d41e7c

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

controllers/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function password() {
101101
$this->view = new \helpers\View();
102102
$this->view->password = true;
103103
if(isset($_POST['password']))
104-
$this->view->hash = hash("sha512", \F3::get('salt') . $_POST['password']);
104+
$this->view->hash = password_hash($_POST['password'], PASSWORD_DEFAULT);
105105
echo $this->view->render('templates/login.phtml');
106106
}
107107

defaults.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ items_lifetime=30
1515
base_url=
1616
username=
1717
password=
18-
salt=lkjl1289
1918
public=
2019
html_title=selfoss
2120
rss_title=selfoss feed

helpers/Authentication.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function loginWithoutUser() {
9898
public function login($username, $password) {
9999
if($this->enabled()) {
100100
if(
101-
$username == \F3::get('username') && hash("sha512", \F3::get('salt') . $password) == \F3::get('password')
101+
$username == \F3::get('username') && password_verify($password, \F3::get('password'))
102102
) {
103103
$this->loggedin = true;
104104
$_SESSION['loggedin'] = true;

0 commit comments

Comments
 (0)