From 785d404c84c153bda7d45d3aedfefa81985703b3 Mon Sep 17 00:00:00 2001 From: anuko Date: Wed, 1 Mar 2017 21:59:03 +0000 Subject: [PATCH] More usage of PasswordField element type. --- WEB-INF/lib/form/Form.class.php | 4 +--- WEB-INF/lib/form/TextArea.class.php | 1 - WEB-INF/lib/form/TextField.class.php | 8 +------- WEB-INF/templates/footer.tpl | 2 +- admin_options.php | 4 ++-- admin_team_add.php | 4 ++-- admin_team_edit.php | 4 ++-- mobile/login.php | 2 +- mobile/user_add.php | 4 ++-- mobile/user_edit.php | 4 ++-- password_change.php | 4 ++-- profile_edit.php | 4 ++-- register.php | 4 ++-- user_add.php | 4 ++-- user_edit.php | 4 ++-- 15 files changed, 24 insertions(+), 33 deletions(-) diff --git a/WEB-INF/lib/form/Form.class.php b/WEB-INF/lib/form/Form.class.php index 868a3b3c..1beb590c 100644 --- a/WEB-INF/lib/form/Form.class.php +++ b/WEB-INF/lib/form/Form.class.php @@ -59,7 +59,6 @@ class Form { import('form.TextField'); $el = new TextField($arguments['name']); $el->setMaxLength(@$arguments['maxlength']); - if (isset($arguments['aspassword'])) $el->setAsPassword($arguments['aspassword']); break; case 'password': @@ -69,8 +68,7 @@ class Form { break; // TODO: refactoring ongoing down from here. -// aspassword - change this name to something better? Perhaps. -// Change $arguments to something better too (maybe). $args or $params? +// Change $arguments to something better (maybe). $args or $params? case "datefield": import('form.DateField'); $el = new DateField($arguments["name"]); diff --git a/WEB-INF/lib/form/TextArea.class.php b/WEB-INF/lib/form/TextArea.class.php index 728f4629..ea1009a8 100644 --- a/WEB-INF/lib/form/TextArea.class.php +++ b/WEB-INF/lib/form/TextArea.class.php @@ -29,7 +29,6 @@ import('form.FormElement'); class TextArea extends FormElement { - var $mPassword = false; var $mColumns = ""; var $mRows = ""; var $class = 'TextArea'; diff --git a/WEB-INF/lib/form/TextField.class.php b/WEB-INF/lib/form/TextField.class.php index b4b1c5d6..45455d0d 100644 --- a/WEB-INF/lib/form/TextField.class.php +++ b/WEB-INF/lib/form/TextField.class.php @@ -29,8 +29,6 @@ import('form.FormElement'); class TextField extends FormElement { - var $mPassword = false; - //var $class = 'TextField'; function __construct($name,$value="") { @@ -38,9 +36,6 @@ class TextField extends FormElement { $this->name = $name; $this->value = $value; } - - function setAsPassword($name) { $this->mPassword = $name; } - function getAsPassword() { return $this->mPassword; } function getHtml() { if (!$this->isEnabled()) { @@ -49,8 +44,7 @@ class TextField extends FormElement { if ($this->id=="") $this->id = $this->name; - $html = "\n\tmPassword ? " type=\"password\"" : " type=\"text\""); + $html = "\n\tname\" id=\"$this->id\""; if ($this->size!="") diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 69c06a38..13443f6d 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.10.38.3614 | Copyright © Anuko | +  Anuko Time Tracker 1.10.38.3615 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/admin_options.php b/admin_options.php index 5431b22a..ae901d6d 100644 --- a/admin_options.php +++ b/admin_options.php @@ -54,8 +54,8 @@ $form = new Form('optionsForm'); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','value'=>$cl_name)); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'login','value'=>$cl_login)); if (!$auth->isPasswordExternal()) { - $form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'password1','aspassword'=>true,'value'=>$cl_password1)); - $form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'password2','aspassword'=>true,'value'=>$cl_password2)); + $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'password1','value'=>$cl_password1)); + $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'password2','value'=>$cl_password2)); } $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'email','value'=>$cl_email)); $form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->getKey('button.submit'))); diff --git a/admin_team_add.php b/admin_team_add.php index d17f864f..de18950b 100644 --- a/admin_team_add.php +++ b/admin_team_add.php @@ -52,8 +52,8 @@ $form->addInput(array('type'=>'text','maxlength'=>'200','name'=>'team_name','val $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'manager_name','value'=>$cl_manager_name)); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'manager_login','value'=>$cl_manager_login)); if (!$auth->isPasswordExternal()) { - $form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'password1','aspassword'=>true,'value'=>$cl_password1)); - $form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'password2','aspassword'=>true,'value'=>$cl_password2)); + $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'password1','value'=>$cl_password1)); + $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'password2','value'=>$cl_password2)); } $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'manager_email','value'=>$cl_manager_email)); $form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->getKey('button.submit'))); diff --git a/admin_team_edit.php b/admin_team_edit.php index 09ef866d..6f44ee9a 100644 --- a/admin_team_edit.php +++ b/admin_team_edit.php @@ -64,8 +64,8 @@ $form->addInput(array('type'=>'text','maxlength'=>'80','name'=>'team_name','valu $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'manager_name','value'=>$cl_manager_name)); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'manager_login','value'=>$cl_manager_login)); if (!$auth->isPasswordExternal()) { - $form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'password1','aspassword'=>true,'value'=>$cl_password1)); - $form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'password2','aspassword'=>true,'value'=>$cl_password2)); + $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'password1','value'=>$cl_password1)); + $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'password2','value'=>$cl_password2)); } $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'manager_email','value'=>$cl_manager_email)); $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$team_id)); diff --git a/mobile/login.php b/mobile/login.php index a0747deb..538a0b54 100644 --- a/mobile/login.php +++ b/mobile/login.php @@ -40,7 +40,7 @@ $cl_password = $request->getParameter('password'); $form = new Form('loginForm'); $form->addInput(array('type'=>'text','size'=>'25','maxlength'=>'100','name'=>'login','style'=>'width: 220px;','value'=>$cl_login)); -$form->addInput(array('type'=>'text','size'=>'25','maxlength'=>'50','name'=>'password','style'=>'width: 220px;','aspassword'=>true,'value'=>$cl_password)); +$form->addInput(array('type'=>'password','size'=>'25','maxlength'=>'50','name'=>'password','style'=>'width: 220px;','value'=>$cl_password)); $form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on btn_login click. $form->addInput(array('type'=>'submit','name'=>'btn_login','onclick'=>'browser_today.value=get_date()','value'=>$i18n->getKey('button.login'))); diff --git a/mobile/user_add.php b/mobile/user_add.php index 681ddd5c..c1f7e291 100644 --- a/mobile/user_add.php +++ b/mobile/user_add.php @@ -77,8 +77,8 @@ $form = new Form('userForm'); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','value'=>$cl_name)); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'login','value'=>$cl_login)); if (!$auth->isPasswordExternal()) { - $form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'pas1','aspassword'=>true,'value'=>$cl_password1)); - $form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'pas2','aspassword'=>true,'value'=>$cl_password2)); + $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'pas1','value'=>$cl_password1)); + $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'pas2','value'=>$cl_password2)); } $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'email','value'=>$cl_email)); diff --git a/mobile/user_edit.php b/mobile/user_edit.php index 06cfdf95..204e7137 100644 --- a/mobile/user_edit.php +++ b/mobile/user_edit.php @@ -107,8 +107,8 @@ $form = new Form('userForm'); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','value'=>$cl_name)); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'login','value'=>$cl_login)); if (!$auth->isPasswordExternal()) { - $form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'pas1','aspassword'=>true,'value'=>$cl_password1)); - $form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'pas2','aspassword'=>true,'value'=>$cl_password2)); + $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'pas1','value'=>$cl_password1)); + $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'pas2','value'=>$cl_password2)); } $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'email','value'=>$cl_email)); diff --git a/password_change.php b/password_change.php index b6fd4dd9..89e79c7f 100644 --- a/password_change.php +++ b/password_change.php @@ -59,8 +59,8 @@ $cl_password1 = $request->getParameter('password1'); $cl_password2 = $request->getParameter('password2'); $form = new Form('newPasswordForm'); -$form->addInput(array('type'=>'text','maxlength'=>'120','name'=>'password1','aspassword'=>true,'value'=>$cl_password1)); -$form->addInput(array('type'=>'text','maxlength'=>'120','name'=>'password2','aspassword'=>true,'value'=>$cl_password2)); +$form->addInput(array('type'=>'password','maxlength'=>'120','name'=>'password1','value'=>$cl_password1)); +$form->addInput(array('type'=>'password','maxlength'=>'120','name'=>'password2','value'=>$cl_password2)); $form->addInput(array('type'=>'hidden','name'=>'ref','value'=>$cl_ref)); $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->getKey('button.save'))); diff --git a/profile_edit.php b/profile_edit.php index 3bf547ac..3504dcef 100644 --- a/profile_edit.php +++ b/profile_edit.php @@ -108,8 +108,8 @@ $form = new Form('profileForm'); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','value'=>$cl_name)); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'login','value'=>$cl_login,'enable'=>$can_change_login)); if (!$auth->isPasswordExternal()) { - $form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'password1','aspassword'=>true,'value'=>$cl_password1)); - $form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'password2','aspassword'=>true,'value'=>$cl_password2)); + $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'password1','value'=>$cl_password1)); + $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'password2','value'=>$cl_password2)); } $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'email','value'=>$cl_email,'enable'=>$can_change_login)); if ($user->canManageTeam()) { diff --git a/register.php b/register.php index 9984460c..99e9539b 100644 --- a/register.php +++ b/register.php @@ -56,8 +56,8 @@ $form->addInput(array('type'=>'text','maxlength'=>'200','name'=>'team_name','val $form->addInput(array('type'=>'text','maxlength'=>'7','name'=>'currency','value'=>$cl_currency)); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'manager_name','value'=>$cl_manager_name)); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'manager_login','value'=>$cl_manager_login)); -$form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'password1','aspassword'=>true,'value'=>$cl_password1)); -$form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'password2','aspassword'=>true,'value'=>$cl_password2)); +$form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'password1','value'=>$cl_password1)); +$form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'password2','value'=>$cl_password2)); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'manager_email','value'=>$cl_manager_email)); $form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->getKey('button.submit'))); diff --git a/user_add.php b/user_add.php index 82e55cf1..a38ef4f8 100644 --- a/user_add.php +++ b/user_add.php @@ -77,8 +77,8 @@ $form = new Form('userForm'); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','style'=>'width: 300px;','value'=>$cl_name)); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'login','style'=>'width: 300px;','value'=>$cl_login)); if (!$auth->isPasswordExternal()) { - $form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'pas1','aspassword'=>true,'value'=>$cl_password1)); - $form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'pas2','aspassword'=>true,'value'=>$cl_password2)); + $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'pas1','value'=>$cl_password1)); + $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'pas2','value'=>$cl_password2)); } $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'email','value'=>$cl_email)); diff --git a/user_edit.php b/user_edit.php index 5fd3b7ec..406d3135 100644 --- a/user_edit.php +++ b/user_edit.php @@ -107,8 +107,8 @@ $form = new Form('userForm'); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','style'=>'width: 300px;','value'=>$cl_name)); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'login','style'=>'width: 300px;','value'=>$cl_login)); if (!$auth->isPasswordExternal()) { - $form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'pas1','aspassword'=>true,'value'=>$cl_password1)); - $form->addInput(array('type'=>'text','maxlength'=>'30','name'=>'pas2','aspassword'=>true,'value'=>$cl_password2)); + $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'pas1','value'=>$cl_password1)); + $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'pas2','value'=>$cl_password2)); } $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'email','style'=>'width: 300px;','value'=>$cl_email)); -- 2.20.1