[aur-dev] [PATCH 1/2] Fix user name length limit on the account edit form
Change the maxlength attribute of the user name input field such that it corresponds to the username_max_len option. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org> --- web/template/account_edit_form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/template/account_edit_form.php b/web/template/account_edit_form.php index 16655c0..b25ff39 100644 --- a/web/template/account_edit_form.php +++ b/web/template/account_edit_form.php @@ -17,7 +17,7 @@ <fieldset> <p> <label for="id_username"><?= __("Username") ?>:</label> - <input type="text" size="30" maxlength="64" name="U" id="id_username" value="<?= htmlspecialchars($U,ENT_QUOTES) ?>" /> (<?= __("required") ?>) + <input type="text" size="30" maxlength="<?= config_get_int('options', 'username_max_len'); ?>" name="U" id="id_username" value="<?= htmlspecialchars($U,ENT_QUOTES) ?>" /> (<?= __("required") ?>) </p> <?php # Only TUs or Devs can promote/demote/suspend a user -- 2.6.2
According to RFC 3696 (and the associated errata), an email address can be up to 256 characters long. Change the database field and the length limit on all input fields accordingly. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org> --- schema/aur-schema.sql | 2 +- upgrading/4.2.0.txt | 6 ++++++ web/html/login.php | 2 +- web/template/account_edit_form.php | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/schema/aur-schema.sql b/schema/aur-schema.sql index 0a0c806..98e8be0 100644 --- a/schema/aur-schema.sql +++ b/schema/aur-schema.sql @@ -25,7 +25,7 @@ CREATE TABLE Users ( AccountTypeID TINYINT UNSIGNED NOT NULL DEFAULT 1, Suspended TINYINT UNSIGNED NOT NULL DEFAULT 0, Username VARCHAR(32) NOT NULL, - Email VARCHAR(64) NOT NULL, + Email VARCHAR(256) NOT NULL, HideEmail TINYINT UNSIGNED NOT NULL DEFAULT 0, Passwd CHAR(32) NOT NULL, Salt CHAR(32) NOT NULL DEFAULT '', diff --git a/upgrading/4.2.0.txt b/upgrading/4.2.0.txt index 37cbeae..c195f41 100644 --- a/upgrading/4.2.0.txt +++ b/upgrading/4.2.0.txt @@ -9,3 +9,9 @@ CREATE TABLE OfficialProviders ( ) ENGINE = InnoDB; CREATE UNIQUE INDEX ProviderNameProvides ON OfficialProviders (Name, Provides); ---- + +2. Resize the email address field: + +---- +ALTER TABLE Users MODIFY Email VARCHAR(256) NOT NULL; +---- diff --git a/web/html/login.php b/web/html/login.php index cef9be4..0a2a1c9 100644 --- a/web/html/login.php +++ b/web/html/login.php @@ -29,7 +29,7 @@ html_header('AUR ' . __("Login")); <?php endif; ?> <p> <label for="id_username"><?= __('User name or email address') . ':'; ?></label> - <input id="id_username" type="text" name="user" size="30" maxlength="<?= config_get_int('options', 'username_max_len'); ?>" value="<?php if (isset($_POST['user'])) { print htmlspecialchars($_POST['user'], ENT_QUOTES); } ?>" autofocus="autofocus" /> + <input id="id_username" type="text" name="user" size="30" maxlength="<?= max(config_get_int('options', 'username_max_len'), 256); ?>" value="<?php if (isset($_POST['user'])) { print htmlspecialchars($_POST['user'], ENT_QUOTES); } ?>" autofocus="autofocus" /> </p> <p> <label for="id_password"><?= __('Password') . ':'; ?></label> diff --git a/web/template/account_edit_form.php b/web/template/account_edit_form.php index b25ff39..28da203 100644 --- a/web/template/account_edit_form.php +++ b/web/template/account_edit_form.php @@ -69,7 +69,7 @@ <p> <label for="id_email"><?= __("Email Address") ?>:</label> - <input type="text" size="30" maxlength="64" name="E" id="id_email" value="<?= htmlspecialchars($E,ENT_QUOTES) ?>" /> (<?= __("required") ?>) + <input type="text" size="30" maxlength="256" name="E" id="id_email" value="<?= htmlspecialchars($E,ENT_QUOTES) ?>" /> (<?= __("required") ?>) </p> <p> -- 2.6.2
participants (1)
-
Lukas Fleischer