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)

52     if ($INPUT->server->str('REMOTE_USER') === '') {
53 $INPUT->server->remove('REMOTE_USER');
59 foreach ($plugin_controller->getList('auth') as $plugin) {
61 $auth = $plugin_controller->load('auth', $plugin);
67 msg($lang['authtempfail'], -1);
71 if ($auth->success == false) {
75 msg($lang['authtempfail'], -1);
80 $INPUT->set('http_credentials', false);
81 if (!$conf['rememberme']) $INPUT->set('r', false);
85 …$header = $INPUT->server->str('HTTP_AUTHORIZATION') ?: $INPUT->server->str('REDIRECT_HTTP_AUTHORIZ…
86 if (preg_match('~^Basic ([a-z\d/+]*={0,2})$~i', $header, $matches)) {
92 …if (!$INPUT->str('u') && empty($_COOKIE[DOKU_COOKIE]) && !empty($INPUT->server->str('PHP_AUTH_USER…
93 $INPUT->set('u', $INPUT->server->str('PHP_AUTH_USER'));
94 $INPUT->set('p', $INPUT->server->str('PHP_AUTH_PW'));
95 $INPUT->set('http_credentials', true);
99 if (true === $auth->success) {
100 $INPUT->set('u', $auth->cleanUser(stripctl($INPUT->str('u'))));
101 $INPUT->set('p', stripctl($INPUT->str('p')));
107 if ($auth->canDo('external')) {
108 $ok = $auth->trustExternal($INPUT->str('u'), $INPUT->str('p'), $INPUT->bool('r'));
115 'user' => $INPUT->str('u'),
116 'password' => $INPUT->str('p'),
117 'sticky' => $INPUT->bool('r'),
118 'silent' => $INPUT->bool('http_credentials')
156 // if user is not logged in, this ACL line is meaningless - skip it
157 if (!$INPUT->server->has('REMOTE_USER')) continue;
159 $id = str_replace('%USER%', cleanID($INPUT->server->str('REMOTE_USER')), $id);
160 … $rest = str_replace('%USER%', auth_nameencode($INPUT->server->str('REMOTE_USER')), $rest);
213 // check authorization header
219 // check x-dokuwiki-token header
220 if (isset($headers['x-dokuwiki-token'])) {
221 $token = $headers['x-dokuwiki-token'];
226 // check token
230 msg(hsc($e->getMessage()), -1);
235 $user = $authtoken->getUser();
236 $USERINFO = $auth->getUserData($user);
240 $INPUT->server->set('REMOTE_USER', $user);
242 $_SESSION[DOKU_COOKIE]['auth']['pass'] = 'nope';
272 * together with the username in a cookie - the same info is stored
288 * @param string $pass Cleartext Password
296 function auth_login($user, $pass, $sticky = false, $silent = false) argument
310 …if (!empty($pass)) usleep(random_int(0, 250)); // add a random delay to prevent timing attacks #44…
311 if (!empty($pass) && $auth->checkPass($user, $pass)) {
313 $INPUT->server->set('REMOTE_USER', $user);
314 $secret = auth_cookiesalt(!$sticky, true); //bind non-sticky to session
315 auth_setCookie($user, auth_encrypt($pass, $secret), $sticky);
318 //invalid credentials - log off
321 msg($lang['badlogin'], -1);
328 [$user, $sticky, $pass] = auth_getCookie();
329 if ($user && $pass) {
330 // we got a cookie - see if we can trust it
337 isset($session['pass']) &&
338 $auth->useSessionCache($user) &&
339 ($session['time'] >= time() - $conf['auth_security_timeout']) &&
341 ($session['pass'] === sha1($pass)) && //still crypted
344 // he has session, cookie and browser right - let him in
345 $INPUT->server->set('REMOTE_USER', $user);
350 // no we don't trust it yet - recheck pass but silent
351 $secret = auth_cookiesalt(!$sticky, true); //bind non-sticky to session
352 $pass = auth_decrypt($pass, $secret);
353 return auth_login($user, $pass, $sticky, true);
364 * This is neither unique nor unfakable - still it adds some
382 $INPUT->server->str('HTTP_USER_AGENT'),
383 $INPUT->server->str('HTTP_ACCEPT_LANGUAGE'),
469 $cipher->setPassword($secret, 'pbkdf2', 'sha1', 'phpseclib');
470 $cipher->setIV($iv);
474 http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf, Appendix C
478 return $cipher->encrypt($iv . $data);
494 $cipher->setPassword($secret, 'pbkdf2', 'sha1', 'phpseclib');
495 $cipher->setIV($iv);
498 return $cipher->decrypt(substr($ciphertext, 16));
513 * @param bool $keepbc - when true, the breadcrumb data is not cleared
529 if (isset($_SESSION[DOKU_COOKIE]['auth']['pass']))
530 unset($_SESSION[DOKU_COOKIE]['auth']['pass']);
535 $INPUT->server->remove('REMOTE_USER');
540 'expires' => time() - 600000,
548 $auth->logOff();
553 * Check if a user is a manager
555 * Should usually be called without any parameters to check the current
581 if (!$INPUT->server->has('REMOTE_USER')) {
584 $user = $INPUT->server->str('REMOTE_USER');
589 if ($USERINFO && $user === $INPUT->server->str('REMOTE_USER')) {
592 $groups = $auth->getUserData($user);
601 // check superuser match
604 // check managers
616 * Check if a user is admin
653 if (!$auth->isCaseSensitive()) {
657 $user = $auth->cleanUser($user);
658 $groups = array_map($auth->cleanGroup(...), $groups);
669 if (!$auth->isCaseSensitive()) $member = PhpString::strtolower($member);
671 $member = $auth->cleanGroup(substr($member, 1));
674 $member = $auth->cleanUser($member);
701 …return auth_aclcheck($id, $INPUT->server->str('REMOTE_USER'), is_array($USERINFO) ? $USERINFO['grp…
727 * default ACL check method
760 if (!$auth->isCaseSensitive()) {
764 $user = auth_nameencode($auth->cleanUser($user));
765 $groups = array_map($auth->cleanGroup(...), $groups);
773 $perm = -1;
781 //check exact match first
787 if (!$auth->isCaseSensitive() && $acl[1] !== '@ALL') {
798 if ($perm > -1) {
799 //we had a match - return it
817 if (!$auth->isCaseSensitive() && $acl[1] !== '@ALL') {
828 //we had a match - return it
829 if ($perm != -1) {
855 * are encoded UTF-8 multibyte are left as is (different from usual
880 '/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/',
886 '/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/',
904 return '%' . dechex(ord(substr($matches[1], -1)));
930 if ($evt->advise_before(true)) {
934 $s = '!$%&?+*~#-_:.;,'; // specials
938 $data['password'] .= $c[auth_random(0, strlen($c) - 1)];
939 $data['password'] .= $v[auth_random(0, strlen($v) - 1)];
940 $data['password'] .= $a[auth_random(0, strlen($a) - 1)];
943 $data['password'] .= $s[auth_random(0, strlen($s) - 1)] . auth_random(10, 99);
945 $evt->advise_after();
966 $user = $auth->cleanUser($user);
967 $userinfo = $auth->getUserData($user, false);
979 $mail->to($mail->getCleanName($userinfo['name']) . ' <' . $userinfo['mail'] . '>');
980 $mail->subject($lang['regpwmail']);
981 $mail->setBody($text, $trep);
982 return $mail->send();
988 * This registers a new user - Data is read directly from $_POST
1003 if (!$INPUT->post->bool('save')) return false;
1007 $login = trim($auth->cleanUser($INPUT->post->str('login')));
1008 $fullname = trim(preg_replace('/[\x00-\x1f:<>&%,;]+/', '', $INPUT->post->str('fullname')));
1009 $email = trim(preg_replace('/[\x00-\x1f:<>&%,;]+/', '', $INPUT->post->str('email')));
1010 $pass = $INPUT->post->str('pass');
1011 $passchk = $INPUT->post->str('passchk');
1014 msg($lang['regmissing'], -1);
1019 $pass = auth_pwgen($login); // automatically generate password
1020 } elseif (empty($pass) || empty($passchk)) {
1021 msg($lang['regmissing'], -1); // complain about missing passwords
1023 } elseif ($pass != $passchk) {
1024 msg($lang['regbadpass'], -1); // complain about misspelled passwords
1028 //check mail
1030 msg($lang['regbadmail'], -1);
1035 if (!$auth->triggerUserMod('create', [$login, $pass, $fullname, $email])) {
1036 msg($lang['regfail'], -1);
1042 $subscription->sendRegister($login, $fullname, $email);
1051 if (auth_sendPassword($login, $pass)) {
1055 msg($lang['regmailfail'], -1);
1076 if (!$INPUT->post->bool('save')) return false;
1080 msg($lang['profna'], -1);
1085 $changes['pass'] = $INPUT->post->str('newpass');
1086 $changes['name'] = $INPUT->post->str('fullname');
1087 $changes['mail'] = $INPUT->post->str('email');
1089 // check misspelled passwords
1090 if ($changes['pass'] != $INPUT->post->str('passchk')) {
1091 msg($lang['regbadpass'], -1);
1096 $changes['name'] = trim(preg_replace('/[\x00-\x1f:<>&%,;]+/', '', $changes['name']));
1097 $changes['mail'] = trim(preg_replace('/[\x00-\x1f:<>&%,;]+/', '', $changes['mail']));
1101 (empty($changes['name']) && $auth->canDo('modName')) ||
1102 (empty($changes['mail']) && $auth->canDo('modMail'))
1104 msg($lang['profnoempty'], -1);
1107 if (!mail_isvalid($changes['mail']) && $auth->canDo('modMail')) {
1108 msg($lang['regbadmail'], -1);
1114 // check for unavailable capabilities
1115 if (!$auth->canDo('modName')) unset($changes['name']);
1116 if (!$auth->canDo('modMail')) unset($changes['mail']);
1117 if (!$auth->canDo('modPass')) unset($changes['pass']);
1121 msg($lang['profnochange'], -1);
1126 if (!$auth->checkPass($INPUT->server->str('REMOTE_USER'), $INPUT->post->str('oldpass'))) {
1127 msg($lang['badpassconfirm'], -1);
1132 if (!$auth->triggerUserMod('modify', [$INPUT->server->str('REMOTE_USER'), &$changes])) {
1133 msg($lang['proffail'], -1);
1137 if (array_key_exists('pass', $changes) && $changes['pass']) {
1139 [/* user */, $sticky, /* pass */] = auth_getCookie();
1140 $pass = auth_encrypt($changes['pass'], auth_cookiesalt(!$sticky, true));
1141 auth_setCookie($INPUT->server->str('REMOTE_USER'), $pass, (bool) $sticky);
1154 * Delete the current logged-in user
1167 if (!$INPUT->post->bool('delete')) return false;
1171 if (!actionOK('profile_delete') || !$auth->canDo('delUser')) {
1172 msg($lang['profnodelete'], -1);
1176 if (!$INPUT->post->bool('confirm_delete')) {
1177 msg($lang['profconfdeletemissing'], -1);
1182 if (!$auth->checkPass($INPUT->server->str('REMOTE_USER'), $INPUT->post->str('oldpass'))) {
1183 msg($lang['badpassconfirm'], -1);
1189 $deleted[] = $INPUT->server->str('REMOTE_USER');
1190 if ($auth->triggerUserMod('delete', [$deleted])) {
1204 * - handling the first request of password reset
1205 * - validating the password reset auth token
1224 msg($lang['resendna'], -1);
1228 $token = preg_replace('/[^a-f0-9]+/', '', $INPUT->str('pwauth'));
1231 // we're in token phase - get user info from token
1235 msg($lang['resendpwdbadauth'], -1);
1236 $INPUT->remove('pwauth');
1240 if ((time() - filemtime($tfile)) > (3 * 60 * 60 * 24)) {
1241 msg($lang['resendpwdbadauth'], -1);
1242 $INPUT->remove('pwauth');
1248 $userinfo = $auth->getUserData($user, false);
1250 msg($lang['resendpwdnouser'], -1);
1255 $pass = $INPUT->str('pass');
1258 if (!$pass) return false;
1259 if ($pass != $INPUT->str('passchk')) {
1260 msg($lang['regbadpass'], -1);
1265 if (!$auth->triggerUserMod('modify', [$user, ['pass' => $pass]])) {
1266 msg($lang['proffail'], -1);
1270 $pass = auth_pwgen($user);
1271 if (!$auth->triggerUserMod('modify', [$user, ['pass' => $pass]])) {
1272 msg($lang['proffail'], -1);
1276 if (auth_sendPassword($user, $pass)) {
1279 msg($lang['regmailfail'], -1);
1288 if (!$INPUT->post->bool('save')) return false;
1290 if (!$INPUT->post->str('login')) {
1291 msg($lang['resendpwdmissing'], -1);
1294 $user = trim($auth->cleanUser($INPUT->post->str('login')));
1297 $userinfo = $auth->getUserData($user, false);
1299 msg($lang['resendpwdnouser'], -1);
1314 $mail->to($userinfo['name'] . ' <' . $userinfo['mail'] . '>');
1315 $mail->subject($lang['regpwmail']);
1316 $mail->setBody($text, $trep);
1317 if ($mail->send()) {
1320 msg($lang['regmailfail'], -1);
1333 * You can pass null as the password to create an unusable hash.
1352 $pass = new PassHash();
1355 if (!method_exists($pass, $call)) {
1356 msg("Unsupported crypt method $method", -1);
1360 return $pass->$call($clear, $salt);
1379 $pass = new PassHash();
1380 return $pass->verify_hash($clear, $crypt);
1387 * @param string $pass encrypted password
1391 function auth_setCookie($user, $pass, $sticky) argument
1399 $USERINFO = $auth->getUserData($user);
1402 $cookie = base64_encode($user) . '|' . ((int) $sticky) . '|' . base64_encode($pass);
1415 $_SESSION[DOKU_COOKIE]['auth']['pass'] = sha1($pass);
1433 [$user, $sticky, $pass] = sexplode('|', $_COOKIE[DOKU_COOKIE], 3, '');
1435 $pass = base64_decode($pass);
1437 return [$user, $sticky, $pass];