public function testChangePassword() { $auth = new Authentification(); $auth->add_user('toto', 'toto'); $auth->change_password('toto', 'toto', 'titi'); $auth->connect('toto', 'titi'); $this->assertTrue($auth->is_connected()['loggedIn']); $auth->deconnect(); $auth->change_password('toto', 'motDePassFaux', 'tata'); $auth->connect('toto', 'tata'); $this->assertFalse($auth->is_connected()['loggedIn']); $auth->deconnect(); $auth->remove_user('toto'); }
break; //--------------- SET_ADMIN ------------------ //--------------- SET_ADMIN ------------------ case 'set_admin': if ($params['isAdmin'] == 'true') { echo json_encode($admin->add_admin($params['login'])); } else { echo json_encode($admin->remove_admin($params['login'])); } break; //--------------- GET_USERS ------------------ //--------------- GET_USERS ------------------ case 'get_users': foreach ($auth->get_users() as $login => $pass) { $users[] = array('login' => $login, 'isAdmin' => $admin->is_admin($login)); } unset($login); unset($pass); echo json_encode($users); break; //--------------- REMOVE_USER ------------------ //--------------- REMOVE_USER ------------------ case 'remove_user': echo json_encode($auth->remove_user($params['login'])); break; //--------------- RESET_USER ------------------ //--------------- RESET_USER ------------------ case 'reset_user': echo json_encode($auth->reset_password($params['login'])); break; }