Lines Matching +full:check +full:- +full:pass -(+path:inc +path:lang) -(+path:lib +path:plugins +path:lang) -(+path:lib +path:tpl +path:dokuwiki +path:lang)

10  * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
33 $this->debugMsg('PDO extension for PHP not found.', -1, __LINE__);
34 $this->success = false;
38 if (!$this->getConf('dsn')) {
39 $this->debugMsg('No DSN specified', -1, __LINE__);
40 $this->success = false;
45 $this->pdo = new PDO(
46 $this->getConf('dsn'),
47 $this->getConf('user'),
48 conf_decodeString($this->getConf('pass')),
56 $this->debugMsg($e);
57 msg($this->getLang('connectfail'), -1);
58 $this->success = false;
63 $this->cando['addUser'] = $this->checkConfig(
64 ['select-user', 'select-user-groups', 'select-groups', 'insert-user', 'insert-group', 'join-group']
68 $this->cando['delUser'] = $this->checkConfig(
69 ['select-user', 'select-user-groups', 'select-groups', 'leave-group', 'delete-user']
73 $this->cando['modLogin'] = $this->checkConfig(
74 ['select-user', 'select-user-groups', 'update-user-login']
78 $this->cando['modPass'] = $this->checkConfig(
79 ['select-user', 'select-user-groups', 'update-user-pass']
83 $this->cando['modName'] = $this->checkConfig(
84 ['select-user', 'select-user-groups', 'update-user-info:name']
88 $this->cando['modMail'] = $this->checkConfig(
89 ['select-user', 'select-user-groups', 'update-user-info:mail']
93 $this->cando['modGroups'] = $this->checkConfig(
94 ['select-user', 'select-user-groups', 'select-groups', 'leave-group', 'join-group', 'insert-group']
98 $this->cando['getUsers'] = $this->checkConfig(
99 ['list-users']
103 $this->cando['getUserCount'] = $this->checkConfig(
104 ['count-users']
108 $this->cando['getGroups'] = $this->checkConfig(
109 ['select-groups']
112 $this->success = true;
116 * Check user+password
119 * @param string $pass the clear text password
122 public function checkPass($user, $pass)
125 $userdata = $this->selectUser($user);
129 if ($this->checkConfig(['check-pass'])) {
130 $userdata['clear'] = $pass;
131 $userdata['hash'] = auth_cryptPassword($pass);
132 $result = $this->query($this->getConf('check-pass'), $userdata);
141 return $passhash->verify_hash($pass, $userdata['hash']);
144 return ($pass === $userdata['clear']);
164 $data = $this->selectUser($user);
171 $data['grps'] = $this->selectUserGroups($data);
200 if (($info = $this->getUserData($user, false)) !== false) {
201 msg($this->getLang('userexists'), -1);
213 $this->pdo->beginTransaction();
216 $ok = $this->query($this->getConf('insert-user'), $userdata);
218 $userdata = $this->getUserData($user, false);
222 $allgroups = $this->selectGroups();
225 $ok = $this->addGroup($group);
229 $allgroups = $this->selectGroups();
233 $ok = $this->joinGroup($userdata, $allgroups[$group]);
237 $this->pdo->commit();
242 $this->pdo->rollBack();
243 $this->debugMsg('Transaction rolled back', 0, __LINE__);
244 msg($this->getLang('writefail'), -1);
258 $this->pdo->beginTransaction();
260 $olddata = $this->getUserData($user);
266 if ($this->getUserData($changes['user'], false)) goto FAIL;
270 $ok = $this->query($this->getConf('update-user-login'), $params);
275 if (isset($changes['pass'])) {
277 $params['clear'] = $changes['pass'];
278 $params['hash'] = auth_cryptPassword($changes['pass']);
280 $ok = $this->query($this->getConf('update-user-pass'), $params);
290 $ok = $this->query($this->getConf('update-user-info'), $params);
296 $allgroups = $this->selectGroups();
301 $ok = $this->leaveGroup($olddata, $allgroups[$group]);
310 $ok = $this->addGroup($group);
316 if ($added > 0) $allgroups = $this->selectGroups();
321 $ok = $this->joinGroup($olddata, $allgroups[$group]);
328 $this->pdo->commit();
333 $this->pdo->rollBack();
334 $this->debugMsg('Transaction rolled back', 0, __LINE__);
335 msg($this->getLang('writefail'), -1);
351 if ($this->deleteUser($user)) $count++;
366 public function retrieveUsers($start = 0, $limit = -1, $filter = null)
383 $result = $this->query($this->getConf('list-users'), $filter);
389 $this->debugMsg("list-users statement did not return 'user' attribute", -1, __LINE__);
392 $users[] = $this->getUserData($row['user']);
395 $this->debugMsg("list-users statement did not return a list of result", -1, __LINE__);
419 $result = $this->query($this->getConf('count-users'), $filter);
421 $this->debugMsg("Statement did not return 'count' attribute", -1, __LINE__);
434 $sql = $this->getConf('insert-group');
436 $result = $this->query($sql, [':group' => $group]);
437 $this->clearGroupCache();
453 $groups = array_keys($this->selectGroups());
471 $sql = $this->getConf('select-user');
473 $result = $this->query($sql, [':user' => $user]);
477 $this->debugMsg('Found more than one matching user', -1, __LINE__);
485 $this->debugMsg("Statement did not return 'user' attribute", -1, __LINE__);
488 if (!isset($data['hash']) && !isset($data['clear']) && !$this->checkConfig(['check-pass'])) {
489 $this->debugMsg("Statement did not return 'clear' or 'hash' attribute", -1, __LINE__);
493 $this->debugMsg("Statement did not return 'name' attribute", -1, __LINE__);
497 $this->debugMsg("Statement did not return 'mail' attribute", -1, __LINE__);
513 $this->pdo->beginTransaction();
515 $userdata = $this->getUserData($user);
517 $allgroups = $this->selectGroups();
522 $this->leaveGroup($userdata, $allgroups[$group]);
526 $ok = $this->query($this->getConf('delete-user'), $userdata);
529 $this->pdo->commit();
533 $this->pdo->rollBack();
546 $sql = $this->getConf('select-user-groups');
547 $result = $this->query($sql, $userdata);
554 $this->debugMsg("No 'group' field returned in select-user-groups statement", -1, __LINE__);
560 $this->debugMsg("select-user-groups statement did not return a list of result", -1, __LINE__);
575 if ($this->groupcache) return $this->groupcache;
577 $sql = $this->getConf('select-groups');
578 $result = $this->query($sql);
585 $this->debugMsg("No 'group' field returned from select-groups statement", -1, __LINE__);
594 $this->debugMsg("select-groups statement did not return a list of result", -1, __LINE__);
606 $this->groupcache = null;
619 $sql = $this->getConf('join-group');
620 $result = $this->query($sql, $data);
635 $sql = $this->getConf('leave-group');
636 $result = $this->query($sql, $data);
652 $this->debugMsg('No SQL query given', -1, __LINE__);
658 $sth = $this->pdo->prepare($sql);
661 // prepare parameters - we only use those that exist in the SQL
669 $sth->bindValue($key, $value, PDO::PARAM_INT);
671 $sth->bindValue($key, $value);
676 $sth->execute();
682 $result = $sth->fetchAll();
684 $result = $sth->rowCount();
691 $hasnextrowset = $sth->nextRowset(); // run next rowset
693 $hasnextrowset = false; // driver does not support multi-rowset, should be executed in one time
700 $dsql = $this->debugSQL($sql, $params, !defined('DOKU_UNITTEST'));
701 $this->debugMsg($e, -1, $line);
702 $this->debugMsg("SQL: <pre>$dsql</pre>", -1, $line);
704 $sth->closeCursor();
718 if (!$this->getConf('debug')) return;
720 $err = -1;
721 $msg = $message->getMessage();
722 if (!$line) $line = $message->getLine();
735 * Check if the given config strings are set
747 $sql = trim($this->getConf($key));
749 // check if sql is set
751 // check if needed params are there
772 $val = $this->pdo->quote($val, PDO::PARAM_INT);
774 $val = $this->pdo->quote($val, PDO::PARAM_BOOL);
778 $val = $this->pdo->quote($val);