Skip to content

Commit

Permalink
Merge pull request #1 from randomchars42/feature/repeat-password
Browse files Browse the repository at this point in the history
add password repeat check when changing password
  • Loading branch information
timum-viw authored Jul 26, 2017
2 parents 82ebe65 + 5ff9f17 commit eff7d24
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/OlmServer/OlmApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -1349,11 +1349,11 @@ public function controllerUsersGetMulti(\Symfony\Component\HttpFoundation\Reques
public function controllerUsersPost(\Symfony\Component\HttpFoundation\Request $request) {
$data = json_decode($request->getContent(), true);

if ($data['password'] !== $data['check']) {
if ($data['password'] !== $data['repeat']) {
$this->sendError(self::RESPONSE_PASSWORDS_DO_NOT_MATCH);
}

unset($data['check']);
unset($data['repeat']);

if (isset($data['password']) && !empty($data['password'])) {
$password = $data['password'];
Expand Down Expand Up @@ -1410,6 +1410,12 @@ public function controllerUsersPatch(\Symfony\Component\HttpFoundation\Request $

$user = $this->getCurrentUser();

if ($data['password'] !== $data['repeat']) {
$this->sendError(self::RESPONSE_PASSWORDS_DO_NOT_MATCH);
}

unset($data['repeat']);

if (!isset($data['check'])) {
$this->sendError(self::RESPONSE_PASSWORD_MISSING);
}
Expand Down
3 changes: 2 additions & 1 deletion src/config/cfg.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php
$cfg['db_host'] = 'localhost';
$cfg['db_prefix'] = 'olm_';
$cfg['db_name'] = 'olm';
$cfg['db_user'] = 'olm';
$cfg['db_password'] = 'olm';
$cfg['jwt_secret'] = 'äö!ad*+lüp"b$ehiu%"§ns';
$cfg['jwt_secret'] = 'secretive_secret';
$cfg['jwt_lifetime'] = 86400;
2 changes: 1 addition & 1 deletion web/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
'charset' => 'utf8mb4',
),
));
$prefix = 'olm_';
$prefix = $cfg['db_prefix'];

// if the app recieves a JSON request decode the content
$app->before(function (Request $request) {
Expand Down

0 comments on commit eff7d24

Please sign in to comment.