Skip to content

[Ui] Adding admin class for password input type. #25918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/code/Magento/Backend/Block/System/Account/Edit/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
protected function _prepareForm()
{
Expand Down Expand Up @@ -114,7 +114,7 @@ protected function _prepareForm()
'name' => 'password',
'label' => __('New Password'),
'title' => __('New Password'),
'class' => 'validate-admin-password admin__control-text'
'class' => 'validate-admin-password'
]
);

Expand All @@ -124,7 +124,7 @@ protected function _prepareForm()
[
'name' => 'password_confirmation',
'label' => __('Password Confirmation'),
'class' => 'validate-cpassword admin__control-text'
'class' => 'validate-cpassword'
]
);

Expand Down Expand Up @@ -152,7 +152,7 @@ protected function _prepareForm()
'label' => __('Your Password'),
'id' => self::IDENTITY_VERIFICATION_PASSWORD_FIELD,
'title' => __('Your Password'),
'class' => 'validate-current-password required-entry admin__control-text',
'class' => 'validate-current-password required-entry',
'required' => true
]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ protected function _addGeneralFieldset($form, $integrationData)
'label' => __('Your Password'),
'id' => self::DATA_CONSUMER_PASSWORD,
'title' => __('Your Password'),
'class' => 'input-text validate-current-password required-entry',
'class' => 'validate-current-password required-entry',
'required' => true
]
);
Expand Down
18 changes: 16 additions & 2 deletions app/code/Magento/User/Block/Role/Tab/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
namespace Magento\User\Block\Role\Tab;

/**
* implementing now
* Info
*
* User role tab info
*
* @SuppressWarnings(PHPMD.DepthOfInheritance)
*/
Expand All @@ -18,6 +20,8 @@ class Info extends \Magento\Backend\Block\Widget\Form\Generic implements \Magent
const IDENTITY_VERIFICATION_PASSWORD_FIELD = 'current_password';

/**
* Get tab label
*
* @return \Magento\Framework\Phrase
*/
public function getTabLabel()
Expand All @@ -26,6 +30,8 @@ public function getTabLabel()
}

/**
* Get tab title
*
* @return string
*/
public function getTabTitle()
Expand All @@ -34,6 +40,8 @@ public function getTabTitle()
}

/**
* Can show tab
*
* @return bool
*/
public function canShowTab()
Expand All @@ -42,6 +50,8 @@ public function canShowTab()
}

/**
* Is tab hidden
*
* @return bool
*/
public function isHidden()
Expand All @@ -50,6 +60,8 @@ public function isHidden()
}

/**
* Before html rendering
*
* @return $this
*/
public function _beforeToHtml()
Expand All @@ -60,6 +72,8 @@ public function _beforeToHtml()
}

/**
* Form initializatiion
*
* @return void
*/
protected function _initForm()
Expand Down Expand Up @@ -99,7 +113,7 @@ protected function _initForm()
'label' => __('Your Password'),
'id' => self::IDENTITY_VERIFICATION_PASSWORD_FIELD,
'title' => __('Your Password'),
'class' => 'input-text validate-current-password required-entry',
'class' => 'validate-current-password required-entry',
'required' => true
]
);
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/User/Block/User/Edit/Tab/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ protected function _prepareForm()
'label' => __('Your Password'),
'id' => self::CURRENT_USER_PASSWORD_FIELD,
'title' => __('Your Password'),
'class' => 'input-text validate-current-password required-entry',
'class' => 'validate-current-password required-entry',
'required' => true
]
);
Expand Down
10 changes: 9 additions & 1 deletion lib/internal/Magento/Framework/Data/Form/Element/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@

use Magento\Framework\Escaper;

/**
* Class Password
*
* Password input type
*/
class Password extends AbstractElement
{
/**
Expand All @@ -33,11 +38,14 @@ public function __construct(
}

/**
* Get field html
*
* @return mixed
*/
public function getHtml()
{
$this->addClass('input-text');
$this->addClass('input-text admin__control-text');

return parent::getHtml();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ public function testGetHtml()
{
$html = $this->_model->getHtml();
$this->assertContains('type="password"', $html);
$this->assertTrue(preg_match('/class=\".*input-text.*\"/i', $html) > 0);
$this->assertTrue(preg_match('/class=\"* input-text admin__control-text.*\"/i', $html) > 0);
}
}