Seite 1 von 1

erlaubte Zeichen

Verfasst: 03.08.2021 14:52
von Gumfuzi
Hallo,
wollte mal kurz in die Runde fragen, was nun offiziell die erlaubten Zeichen beim Usernamen und bei den Passwörtern sind?

Ich muss nämlich einen gemeinsamen Nenner finden bei phpBB3 und Wordpress (falls jemand da auch noch eine Quelle hat, gerne!), welche Sonderzeichen jeweils erlaubt sind.

Danke!

Re: erlaubte Zeichen

Verfasst: 03.08.2021 14:55
von chris1278
Großß und Kleinbuchstaben gehen und @ und # als sonderzeichen ob sonstnochwas geht keine ahnung.

Re: erlaubte Zeichen

Verfasst: 03.08.2021 15:18
von Dr.Death

Code: Alles auswählen

	switch ($config['allow_name_chars'])
	{
		case 'USERNAME_CHARS_ANY':
			$regex = '.+';
		break;

		case 'USERNAME_ALPHA_ONLY':
			$regex = '[A-Za-z0-9]+';
		break;

		case 'USERNAME_ALPHA_SPACERS':
			$regex = '[A-Za-z0-9-[\]_+ ]+';
		break;

		case 'USERNAME_LETTER_NUM':
			$regex = '[\p{Lu}\p{Ll}\p{N}]+';
		break;

		case 'USERNAME_LETTER_NUM_SPACERS':
			$regex = '[-\]_+ [\p{Lu}\p{Ll}\p{N}]+';
		break;

		case 'USERNAME_ASCII':
		default:
			$regex = '[\x01-\x7F]+';
		break;
	}

Re: erlaubte Zeichen

Verfasst: 03.08.2021 15:22
von Gumfuzi
Danke sehr!

Ist das bei den Passwörtern auch genau so?

Re: erlaubte Zeichen

Verfasst: 03.08.2021 15:29
von Dr.Death

Code: Alles auswählen

* Check to see if the password meets the complexity settings
*
* @return	boolean|string	Either false if validation succeeded or a string which will be used as the error message (with the variable name appended)
*/
function validate_password($password)
{
	global $config;

	if ($password === '' || $config['pass_complex'] === 'PASS_TYPE_ANY')
	{
		// Password empty or no password complexity required.
		return false;
	}

	$upp = '\p{Lu}';
	$low = '\p{Ll}';
	$num = '\p{N}';
	$sym = '[^\p{Lu}\p{Ll}\p{N}]';
	$chars = array();

	switch ($config['pass_complex'])
	{
		// No break statements below ...
		// We require strong passwords in case pass_complex is not set or is invalid
		default:

		// Require mixed case letters, numbers and symbols
		case 'PASS_TYPE_SYMBOL':
			$chars[] = $sym;

		// Require mixed case letters and numbers
		case 'PASS_TYPE_ALPHA':
			$chars[] = $num;

		// Require mixed case letters
		case 'PASS_TYPE_CASE':
			$chars[] = $low;
			$chars[] = $upp;
	}

	foreach ($chars as $char)
	{
		if (!preg_match('#' . $char . '#u', $password))
		{
			return 'INVALID_CHARS';
		}
	}

	return false;
}
Zu finden in der /includes/function_user.php

Wenn PASS_TYPE_ANY eingestellt ist, wird wohl jedes Zeichen erlaubt sein.....hab ich aber noch nicht selbst mit Emojis getestet ;-)

Re: erlaubte Zeichen

Verfasst: 03.08.2021 15:31
von Gumfuzi
super, danke!