I have chosen to override function which save config value
Create a Folder Customer
Path : App/code/Desiredname/Customer
create folders etc,i18n,Model and file registration.php
Path/etc/module.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Desiredname_Customer" setup_version="1.1.6">
<sequence>
<module name="Magento_Customer"/>
</sequence>
</module>
</config>
Path/app/etc/adminhtml/system.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<group id="password" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="reset_link_expiration_period" translate="label comment" type="text" sortOrder="60" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
<label>Recovery Link Expiration Period (hours)</label>
<comment>Please enter a number 1 or greater in this field.</comment>
<validate>required-entry validate-greater-than-zero</validate>
<backend_model>Desiredname\Customer\Plugin\Model\Config\Backend\Password\Link\Expirationperiod</backend_model>
</field>
</group>
</system>
</config>
This two lines are important
<validate>required-entry validate-greater-than-zero</validate>
<backend_model>Desiredname\Customer\Plugin\Model\Config\Backend\Password\Link\Expirationperiod</backend_model>
Path\Plugin\Model\Config\Backend\Password\Link\Expirationperiod
Above will allow to insert value in decimals but while saving there is PHP validation to check decimal values and value below 1. Hence had to override this functionality
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Desiredname\Customer\Plugin\Model\Config\Backend\Password\Link;
/**
* Customer Reset Password Link Expiration period backend model
*
* @author Magento Core Team <[email protected]>
*/
class Expirationperiod extends \Magento\Framework\App\Config\Value
{
/**
* Validate expiration period value before saving
*
* @return $this
*/
public function beforeSave()
{
parent::beforeSave();
$resetPasswordLinkExpirationPeriod = (float)$this->getValue();
$this->setValue((string)$resetPasswordLinkExpirationPeriod);
return $this;
}
}
To change Label at admin level
Path/i18n/en_US.csv
"Please enter a number 1 or greater in this field.","Please enter a number 0 or greater in this field."