From 5d37578eccfebd17b2e4ae2929ad8e1db33a9a9e Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 8 Jan 2018 00:35:53 -0800 Subject: [PATCH] Add support for "visible password" checkbox - make redundant password and country optional in create account. - fix appearance of form items - remove unused code --- html/inc/account.inc | 19 +++++++++++++++++++ html/inc/bootstrap.inc | 2 +- html/inc/user_util.inc | 8 ++++---- html/inc/util.inc | 13 ------------- html/user/custom.css | 4 ++++ 5 files changed, 28 insertions(+), 18 deletions(-) diff --git a/html/inc/account.inc b/html/inc/account.inc index 5e22ff096c..256b00f257 100644 --- a/html/inc/account.inc +++ b/html/inc/account.inc @@ -29,6 +29,25 @@ function make_login_token($user) { return $token; } +// return HTML string for a checkbox for toggling password visibility +// +function passwd_visible_checkbox($name) { + return sprintf(' + + Show password + ', $name + ); +} + function create_account_form($teamid, $next_url) { global $recaptcha_public_key; form_input_hidden('next_url', $next_url); diff --git a/html/inc/bootstrap.inc b/html/inc/bootstrap.inc index ca00b8478f..99535fa128 100644 --- a/html/inc/bootstrap.inc +++ b/html/inc/bootstrap.inc @@ -402,7 +402,7 @@ function form_checkboxes($label, $items) { } else { echo "
\n"; } - echo sprintf(' %s
+ echo sprintf(' %s ', $i[0], $i[2]?"checked":"", $i[1] ); diff --git a/html/inc/user_util.inc b/html/inc/user_util.inc index 529cd43112..388d06ba3d 100644 --- a/html/inc/user_util.inc +++ b/html/inc/user_util.inc @@ -175,8 +175,8 @@ function validate_post_make_user() { } $passwd = post_str("passwd"); - $passwd2 = post_str("passwd2"); - if ($passwd != $passwd2) { + $passwd2 = post_str("passwd2", true); + if ($passwd2 && $passwd != $passwd2) { show_error(tra("New passwords are different")); } @@ -195,8 +195,8 @@ function validate_post_make_user() { $passwd_hash = md5($passwd.$new_email_addr); - $country = post_str("country"); - if ($country == "") { + $country = post_str("country", true); + if (!$country) { $country = "None"; } if (!is_valid_country($country)) { diff --git a/html/inc/util.inc b/html/inc/util.inc index c6fb705771..0358daa73e 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -864,19 +864,6 @@ function show_button_small($url, $text, $desc=null) { echo button_text($url, $text, $desc, "btn-primary btn-xs"); } -// When multiple buttons (or actions) are presented in a list you can -// use this convenience method to avoid having to wrap each button in
  • elements -// @param url The destination URL of the button -// @param text The text to display on the button -// @param desc The title of the destination - typically used as a popup -// @param class The optional CSS class of the button. Defaults to a standard button -// -function show_actionlist_button($url, $text, $desc, $class="btn btn-default"){ - echo "
  • "; - echo show_button($url, $text, $desc, $class); - echo "
  • "; -} - // used for showing icons // function show_image($src, $title, $alt, $height=null) { diff --git a/html/user/custom.css b/html/user/custom.css index 326e6b9fde..a91e70daca 100644 --- a/html/user/custom.css +++ b/html/user/custom.css @@ -16,3 +16,7 @@ blockquote { color: white; text-decoration: underline; } + +.form-horizontal .control-label { + padding-top: 0px; +}