ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilPasswordInputGUI Class Reference

This class represents a password property in a property form. More...

+ Inheritance diagram for ilPasswordInputGUI:
+ Collaboration diagram for ilPasswordInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setRetype ($a_val)
 Set retype on/off. More...
 
 getRetype ()
 Get retype on/off. More...
 
 setRetypeValue ($a_retypevalue)
 Set Retype Value. More...
 
 getRetypeValue ()
 Get Retype Value. More...
 
 setMaxLength ($a_maxlength)
 Set Max Length. More...
 
 getMaxLength ()
 Get Max Length. More...
 
 setSize ($a_size)
 Set Size. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 getSize ()
 Get Size. More...
 
 setValidateAuthPost ($a_validateauthpost)
 Set Validate required status against authentication POST var. More...
 
 getValidateAuthPost ()
 Get Validate required status against authentication POST var. More...
 
 setRequiredOnAuth ($a_requiredonauth)
 Set input required, if authentication mode allows password setting. More...
 
 getRequiredOnAuth ()
 Get input required, if authentication mode allows password setting. More...
 
 setSkipSyntaxCheck ($a_val)
 Set skip syntax check. More...
 
 getSkipSyntaxCheck ()
 Get skip syntax check. More...
 
 setDisableHtmlAutoComplete ($a_value)
 Set autocomplete. More...
 
 isHtmlAutoCompleteDisabled ()
 Get autocomplete. More...
 
 setUseStripSlashes ($a_stat)
 En/disable use of stripslashes. More...
 
 getUseStripSlashes ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 render ()
 Render item. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem. More...
 
 getSubItems ()
 Get Subitems. More...
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 Get sub form html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 

Protected Attributes

 $value
 
 $size = 20
 
 $validateauthpost = ""
 
 $requiredonauth = false
 
 $maxlength = false
 
 $use_strip_slashes = true
 
 $autocomplete_disabled = true
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Detailed Description

This class represents a password property in a property form.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 11 of file class.ilPasswordInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPasswordInputGUI::__construct (   $a_title = "",
  $a_postvar = "" 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Definition at line 31 of file class.ilPasswordInputGUI.php.

References setRetype(), and setSkipSyntaxCheck().

32  {
33  parent::__construct($a_title, $a_postvar);
34  $this->setRetype(true);
35  $this->setSkipSyntaxCheck(false);
36  }
setRetype($a_val)
Set retype on/off.
setSkipSyntaxCheck($a_val)
Set skip syntax check.
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilPasswordInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Definition at line 254 of file class.ilPasswordInputGUI.php.

References $_POST, $lng, ilAuthUtils\_allowPasswordModificationByAuthMode(), ilAuthUtils\_getAuthMode(), ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getRequiredOnAuth(), getRetype(), getSkipSyntaxCheck(), getUseStripSlashes(), getValidateAuthPost(), ilUtil\isPassword(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashes().

255  {
256  global $lng;
257 
258  if($this->getUseStripSlashes())
259  {
260  $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
261  $_POST[$this->getPostVar()."_retype"] = ilUtil::stripSlashes($_POST[$this->getPostVar()."_retype"]);
262  }
263  if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
264  {
265  $this->setAlert($lng->txt("msg_input_is_required"));
266 
267  return false;
268  }
269  if ($this->getValidateAuthPost() != "")
270  {
272 
273  // check, if password is required dependent on auth mode
275  && trim($_POST[$this->getPostVar()]) == "")
276  {
277  $this->setAlert($lng->txt("form_password_required_for_auth"));
278 
279  return false;
280  }
281 
282  // check, if password is allowed to be set for given auth mode
283  if (trim($_POST[$this->getPostVar()]) != "" &&
285  {
286  $this->setAlert($lng->txt("form_password_not_allowed_for_auth"));
287 
288  return false;
289  }
290  }
291  if ($this->getRetype() &&
292  ($_POST[$this->getPostVar()] != $_POST[$this->getPostVar()."_retype"]))
293  {
294  $this->setAlert($lng->txt("passwd_not_match"));
295 
296  return false;
297  }
298  if (!$this->getSkipSyntaxCheck() &&
299  !ilUtil::isPassword($_POST[$this->getPostVar()],$custom_error) &&
300  $_POST[$this->getPostVar()] != "")
301  {
302  if($custom_error != '') $this->setAlert($custom_error);
303  else $this->setAlert($lng->txt("passwd_invalid"));
304 
305  return false;
306  }
307 
308  return $this->checkSubItemsInput();
309  }
getPostVar()
Get Post Variable.
getSkipSyntaxCheck()
Get skip syntax check.
getRetype()
Get retype on/off.
static _getAuthMode($a_auth_mode, $a_db_handler='')
static isPassword($a_passwd, &$customError=null)
validates a password public
setAlert($a_alert)
Set Alert Text.
static _allowPasswordModificationByAuthMode($a_auth_mode)
Allow password modification.
getValidateAuthPost()
Get Validate required status against authentication POST var.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $lng
Definition: privfeed.php:17
getRequiredOnAuth()
Get input required, if authentication mode allows password setting.
$_POST["username"]
+ Here is the call graph for this function:

◆ getMaxLength()

ilPasswordInputGUI::getMaxLength ( )

Get Max Length.

Returns
int Max Length

Definition at line 113 of file class.ilPasswordInputGUI.php.

References $maxlength.

Referenced by render().

114  {
115  return $this->maxlength;
116  }
+ Here is the caller graph for this function:

◆ getRequiredOnAuth()

ilPasswordInputGUI::getRequiredOnAuth ( )

Get input required, if authentication mode allows password setting.

Returns
boolean require input

Definition at line 184 of file class.ilPasswordInputGUI.php.

References $requiredonauth.

Referenced by checkInput().

185  {
186  return $this->requiredonauth;
187  }
+ Here is the caller graph for this function:

◆ getRetype()

ilPasswordInputGUI::getRetype ( )

Get retype on/off.

Returns
boolean retype

Definition at line 73 of file class.ilPasswordInputGUI.php.

Referenced by checkInput(), and render().

74  {
75  return $this->retype;
76  }
+ Here is the caller graph for this function:

◆ getRetypeValue()

ilPasswordInputGUI::getRetypeValue ( )

Get Retype Value.

Returns
string Retype Value

Definition at line 93 of file class.ilPasswordInputGUI.php.

Referenced by render().

94  {
95  return $this->retypevalue;
96  }
+ Here is the caller graph for this function:

◆ getSize()

ilPasswordInputGUI::getSize ( )

Get Size.

Returns
int Size

Definition at line 144 of file class.ilPasswordInputGUI.php.

References $size.

Referenced by render().

145  {
146  return $this->size;
147  }
+ Here is the caller graph for this function:

◆ getSkipSyntaxCheck()

ilPasswordInputGUI::getSkipSyntaxCheck ( )

Get skip syntax check.

Returns
boolean skip syntax check

Definition at line 204 of file class.ilPasswordInputGUI.php.

Referenced by checkInput().

205  {
206  return $this->skip_syntax_check;
207  }
+ Here is the caller graph for this function:

◆ getUseStripSlashes()

ilPasswordInputGUI::getUseStripSlashes ( )
Returns
type

Definition at line 244 of file class.ilPasswordInputGUI.php.

References $use_strip_slashes.

Referenced by checkInput().

245  {
247  }
+ Here is the caller graph for this function:

◆ getValidateAuthPost()

ilPasswordInputGUI::getValidateAuthPost ( )

Get Validate required status against authentication POST var.

Returns
string POST var

Definition at line 164 of file class.ilPasswordInputGUI.php.

References $validateauthpost.

Referenced by checkInput().

165  {
167  }
+ Here is the caller graph for this function:

◆ getValue()

ilPasswordInputGUI::getValue ( )

Get Value.

Returns
string Value

Definition at line 53 of file class.ilPasswordInputGUI.php.

References $value.

Referenced by render().

54  {
55  return $this->value;
56  }
+ Here is the caller graph for this function:

◆ insert()

ilPasswordInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

Definition at line 379 of file class.ilPasswordInputGUI.php.

References $html, and render().

380  {
381  $html = $this->render();
382 
383  $a_tpl->setCurrentBlock("prop_generic");
384  $a_tpl->setVariable("PROP_GENERIC", $html);
385  $a_tpl->parseCurrentBlock();
386  }
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ isHtmlAutoCompleteDisabled()

ilPasswordInputGUI::isHtmlAutoCompleteDisabled ( )

Get autocomplete.

Returns
bool Value

Definition at line 224 of file class.ilPasswordInputGUI.php.

References $autocomplete_disabled.

Referenced by render().

+ Here is the caller graph for this function:

◆ render()

ilPasswordInputGUI::render ( )

Render item.

Definition at line 314 of file class.ilPasswordInputGUI.php.

References $lng, ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), getMaxLength(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getRetype(), getRetypeValue(), getSize(), getValue(), isHtmlAutoCompleteDisabled(), and ilUtil\prepareFormOutput().

Referenced by insert().

315  {
316  global $lng;
317 
318  $ptpl = new ilTemplate("tpl.prop_password.html", true, true, "Services/Form");
319 
320  if ($this->getRetype())
321  {
322  $ptpl->setCurrentBlock("retype");
323  $ptpl->setVariable("RSIZE", $this->getSize());
324  $ptpl->setVariable("RID", $this->getFieldId());
325  $ptpl->setVariable("RMAXLENGTH", $this->getMaxLength());
326  $ptpl->setVariable("RPOST_VAR", $this->getPostVar());
327 
328  if($this->isHtmlAutoCompleteDisabled())
329  {
330  $ptpl->setVariable("RAUTOCOMPLETE", "autocomplete=\"off\"");
331  }
332 
333  // this is creating an "auto entry" in the setup, if the retype is missing
334  /*$retype_value = ($this->getRetypeValue() != "")
335  ? $this->getRetypeValue()
336  : $this->getValue();*/
337  $retype_value = $this->getRetypeValue();
338  $ptpl->setVariable("PROPERTY_RETYPE_VALUE", ilUtil::prepareFormOutput($retype_value));
339  if ($this->getDisabled())
340  {
341  $ptpl->setVariable("RDISABLED",
342  " disabled=\"disabled\"");
343  }
344  $ptpl->setVariable("TXT_RETYPE", $lng->txt("form_retype_password"));
345  $ptpl->parseCurrentBlock();
346  }
347 
348  if (strlen($this->getValue()))
349  {
350  $ptpl->setCurrentBlock("prop_password_propval");
351  $ptpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
352  $ptpl->parseCurrentBlock();
353  }
354  $ptpl->setVariable("POST_VAR", $this->getPostVar());
355  $ptpl->setVariable("ID", $this->getFieldId());
356  $ptpl->setVariable("SIZE", $this->getSize());
357  $ptpl->setVariable("MAXLENGTH", $this->getMaxLength());
358  if ($this->getDisabled())
359  {
360  $ptpl->setVariable("DISABLED",
361  " disabled=\"disabled\"");
362  }
363  if($this->isHtmlAutoCompleteDisabled())
364  {
365  $ptpl->setVariable("AUTOCOMPLETE", "autocomplete=\"off\"");
366  }
367  if($this->getRequired())
368  {
369  $ptpl->setVariable("REQUIRED", "required=\"required\"");
370  }
371  return $ptpl->get();
372  }
getMaxLength()
Get Max Length.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getPostVar()
Get Post Variable.
getRetypeValue()
Get Retype Value.
getRetype()
Get retype on/off.
isHtmlAutoCompleteDisabled()
Get autocomplete.
getFieldId()
Get Post Variable.
special template class to simplify handling of ITX/PEAR
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDisableHtmlAutoComplete()

ilPasswordInputGUI::setDisableHtmlAutoComplete (   $a_value)

Set autocomplete.

Parameters
bool$a_valueValue

Definition at line 214 of file class.ilPasswordInputGUI.php.

215  {
216  $this->autocomplete_disabled = (bool)$a_value;
217  }

◆ setMaxLength()

ilPasswordInputGUI::setMaxLength (   $a_maxlength)

Set Max Length.

Parameters
int$a_maxlengthMax Length

Definition at line 103 of file class.ilPasswordInputGUI.php.

104  {
105  $this->maxlength = $a_maxlength;
106  }

◆ setRequiredOnAuth()

ilPasswordInputGUI::setRequiredOnAuth (   $a_requiredonauth)

Set input required, if authentication mode allows password setting.

Parameters
boolean$a_requiredonauthrequire input

Definition at line 174 of file class.ilPasswordInputGUI.php.

175  {
176  $this->requiredonauth = $a_requiredonauth;
177  }

◆ setRetype()

ilPasswordInputGUI::setRetype (   $a_val)

Set retype on/off.

Parameters
booleanretype

Definition at line 63 of file class.ilPasswordInputGUI.php.

Referenced by __construct(), ilSharedResourceGUI\initPasswordForm(), ilPersonalSettingsGUI\initPasswordForm(), and ilObjWorkspaceFolderGUI\initPasswordForm().

64  {
65  $this->retype = $a_val;
66  }
+ Here is the caller graph for this function:

◆ setRetypeValue()

ilPasswordInputGUI::setRetypeValue (   $a_retypevalue)

Set Retype Value.

Parameters
string$a_retypevalueRetype Value

Definition at line 83 of file class.ilPasswordInputGUI.php.

Referenced by setValueByArray().

84  {
85  $this->retypevalue = $a_retypevalue;
86  }
+ Here is the caller graph for this function:

◆ setSize()

ilPasswordInputGUI::setSize (   $a_size)

Set Size.

Parameters
int$a_sizeSize

Definition at line 123 of file class.ilPasswordInputGUI.php.

References size.

Referenced by ilObjUserGUI\getValues(), ilSetupGUI\initClientLoginForm(), and ilSetupGUI\initMasterLoginForm().

124  {
125  $this->size = $a_size;
126  }
font size
Definition: langcheck.php:162
+ Here is the caller graph for this function:

◆ setSkipSyntaxCheck()

ilPasswordInputGUI::setSkipSyntaxCheck (   $a_val)

Set skip syntax check.

Parameters
booleanskip syntax check

Definition at line 194 of file class.ilPasswordInputGUI.php.

Referenced by __construct().

195  {
196  $this->skip_syntax_check = $a_val;
197  }
+ Here is the caller graph for this function:

◆ setUseStripSlashes()

ilPasswordInputGUI::setUseStripSlashes (   $a_stat)

En/disable use of stripslashes.

e.g on login screen. Otherwise passwords containing "<" are stripped and therefor authentication fails against external authentication services.

Parameters
type$a_stat

Definition at line 235 of file class.ilPasswordInputGUI.php.

Referenced by ilStartUpGUI\initStandardLoginForm().

236  {
237  $this->use_strip_slashes = $a_stat;
238  }
+ Here is the caller graph for this function:

◆ setValidateAuthPost()

ilPasswordInputGUI::setValidateAuthPost (   $a_validateauthpost)

Set Validate required status against authentication POST var.

Parameters
string$a_validateauthpostPOST var

Definition at line 154 of file class.ilPasswordInputGUI.php.

155  {
156  $this->validateauthpost = $a_validateauthpost;
157  }

◆ setValue()

ilPasswordInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Definition at line 43 of file class.ilPasswordInputGUI.php.

Referenced by setValueByArray().

44  {
45  $this->value = $a_value;
46  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilPasswordInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 133 of file class.ilPasswordInputGUI.php.

References ilFormPropertyGUI\getPostVar(), setRetypeValue(), and setValue().

134  {
135  $this->setValue($a_values[$this->getPostVar()]);
136  $this->setRetypeValue($a_values[$this->getPostVar()."_retype"]);
137  }
getPostVar()
Get Post Variable.
setRetypeValue($a_retypevalue)
Set Retype Value.
setValue($a_value)
Set Value.
+ Here is the call graph for this function:

Field Documentation

◆ $autocomplete_disabled

ilPasswordInputGUI::$autocomplete_disabled = true
protected

Definition at line 23 of file class.ilPasswordInputGUI.php.

Referenced by isHtmlAutoCompleteDisabled().

◆ $maxlength

ilPasswordInputGUI::$maxlength = false
protected

Definition at line 17 of file class.ilPasswordInputGUI.php.

Referenced by getMaxLength().

◆ $requiredonauth

ilPasswordInputGUI::$requiredonauth = false
protected

Definition at line 16 of file class.ilPasswordInputGUI.php.

Referenced by getRequiredOnAuth().

◆ $size

ilPasswordInputGUI::$size = 20
protected

Definition at line 14 of file class.ilPasswordInputGUI.php.

Referenced by getSize().

◆ $use_strip_slashes

ilPasswordInputGUI::$use_strip_slashes = true
protected

Definition at line 18 of file class.ilPasswordInputGUI.php.

Referenced by getUseStripSlashes().

◆ $validateauthpost

ilPasswordInputGUI::$validateauthpost = ""
protected

Definition at line 15 of file class.ilPasswordInputGUI.php.

Referenced by getValidateAuthPost().

◆ $value

ilPasswordInputGUI::$value
protected

Definition at line 13 of file class.ilPasswordInputGUI.php.

Referenced by getValue().


The documentation for this class was generated from the following file: