Skip to content

Commit

Permalink
improv. fix issue with old password
Browse files Browse the repository at this point in the history
  • Loading branch information
nivcoo authored Dec 9, 2021
1 parent cb5403c commit f29d9a6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function ajax_register()
$conditionsChecked = !empty($this->request->data['condition']) || !$this->Configuration->getKey('condition');
if (!empty($this->request->data['pseudo']) && !empty($this->request->data['password']) && $conditionsChecked && !empty($this->request->data['password_confirmation']) && !empty($this->request->data['email'])) { // si tout les champs sont bien remplis
//check uuid if needed
$this->request->data = $this->request->data['xss'];
if ($this->Configuration->getKey('check_uuid')) {
$pseudoToUUID = file_get_contents("https://api.mojang.com/users/profiles/minecraft/" . htmlentities($this->request->data['pseudo']));
if (!$pseudoToUUID) {
Expand Down Expand Up @@ -137,6 +138,7 @@ function ajax_login()
$this->response->type('json');
$this->loadModel('Authentification');
$this->loadModel('User');
$this->request->data = $this->request->data['xss'];
$user_login = $this->User->getAllFromUser($this->request->data['pseudo']);
$infos = $this->Authentification->find('first', ['conditions' => ['user_id' => $user_login['id'], 'enabled' => true]]);

Expand Down Expand Up @@ -279,6 +281,7 @@ function ajax_resetpasswd()
$this->response->type('json');
if ($this->request->is('ajax')) {
if (!empty($this->request->data['password']) and !empty($this->request->data['password2']) and !empty($this->request->data['email']) && !empty($this->request->data['key'])) {
$this->request->data = $this->request->data['xss'];
$reset = $this->User->resetPass($this->request->data, $this);
if (isset($reset['status']) && $reset['status'] === true) {
$this->Session->write('user', $reset['session']);
Expand Down Expand Up @@ -517,6 +520,7 @@ function change_pw()
if ($this->isConnected) {
if ($this->request->is('ajax')) {
if (!empty($this->request->data['password']) and !empty($this->request->data['password_confirmation'])) {
$this->request->data = $this->request->data['xss'];
$password = $this->Util->password($this->request->data['password'], $this->User->getKey('pseudo'));
$password_confirmation = $this->Util->password($this->request->data['password_confirmation'], $this->User->getKey('pseudo'), $password);
if ($password == $password_confirmation) {
Expand Down Expand Up @@ -775,6 +779,7 @@ function admin_edit_ajax()
if ($this->request->is('post')) {
$this->loadModel('User');
if (!empty($this->request->data['id']) && !empty($this->request->data['email']) && !empty($this->request->data['pseudo']) && (!empty($this->request->data['rank']) || $this->request->data['rank'] == 0)) {
$this->request->data = $this->request->data['xss'];
$findUser = $this->User->find('first',
['conditions' => ['id' => intval($this->request->data['id'])]]);
if (empty($findUser)) {
Expand Down

0 comments on commit f29d9a6

Please sign in to comment.