Skip to content

Commit 4878c49

Browse files
Compatible with the 2.4.6 version and Fixed minor bugs.
1 parent 448e466 commit 4878c49

File tree

19 files changed

+270
-94
lines changed

19 files changed

+270
-94
lines changed

Block/Main.php

Lines changed: 109 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
<?php
2+
/*
3+
* Navigate Commerce
4+
*
5+
* @author Navigate Commerce
6+
* @package Navigate_PasswordHideShow
7+
* @copyright Copyright (c) Navigate (https://www.navigatecommerce.com/)
8+
* @license https://www.navigatecommerce.com/end-user-license-agreement
9+
*/
10+
211
namespace Navigate\PasswordHideShow\Block;
312

413
use Magento\Framework\View\Element\Template;
@@ -8,77 +17,157 @@
817

918
class Main extends \Magento\Framework\View\Element\Template
1019
{
11-
const IS_ENABLE = 'passwordhideshow/general/enable';
12-
const ENABLE_LOGIN = 'passwordhideshow/general/enable_login_page';
13-
const ENABLE_REGISTRATION = 'passwordhideshow/general/enable_registration_page';
14-
const ENABLE_EDIT_ACCOUNT = 'passwordhideshow/general/enable_edit_account';
15-
const SHOW_PASSWORD = 'passwordhideshow/general/show_pasword';
16-
const HIDE_PASSWORD = 'passwordhideshow/general/hide_pasword';
17-
20+
protected const IS_ENABLE = 'passwordhideshow/general/enable';
21+
protected const ENABLE_LOGIN = 'passwordhideshow/general/enable_login_page';
22+
protected const ENABLE_REGISTRATION = 'passwordhideshow/general/enable_registration_page';
23+
protected const ENABLE_EDIT_ACCOUNT = 'passwordhideshow/general/enable_edit_account';
24+
protected const SHOW_PASSWORD = 'passwordhideshow/general/show_pasword';
25+
protected const HIDE_PASSWORD = 'passwordhideshow/general/hide_pasword';
26+
27+
/**
28+
* @var StoreManagerInterface
29+
*/
1830
protected $modelStoreManagerInterface;
31+
32+
/**
33+
* Scope config Interface
34+
*
35+
* @var ScopeConfigInterface
36+
*/
1937
protected $scopeConfig;
2038

21-
public function __construct(Template\Context $context, StoreManagerInterface $modelStoreManagerInterface, ScopeConfigInterface $scopeConfig, array $data = [])
22-
{
39+
/**
40+
* Construct method
41+
*
42+
* @param Template\Context $context
43+
* @param StoreManagerInterface $modelStoreManagerInterface
44+
* @param ScopeConfigInterface $scopeConfig
45+
* @param array $data
46+
*/
47+
public function __construct(
48+
Template\Context $context,
49+
StoreManagerInterface $modelStoreManagerInterface,
50+
ScopeConfigInterface $scopeConfig,
51+
array $data = []
52+
) {
2353
$this->modelStoreManagerInterface = $modelStoreManagerInterface;
2454
$this->scopeConfig = $scopeConfig;
2555
parent::__construct($context, $data);
2656
}
2757

58+
/**
59+
* Get Current Store Info
60+
*
61+
* @return $this
62+
*/
2863
public function getCurrentStoreInfo()
2964
{
3065
return $this->modelStoreManagerInterface->getStore()->getId();
3166
}
3267

68+
/**
69+
* Function to check enabled or not
70+
*
71+
* @return boolean
72+
*/
3373
public function isEnable()
3474
{
35-
return (bool)$this->scopeConfig->getValue(self::IS_ENABLE, ScopeInterface::SCOPE_STORE, $this->getCurrentStoreInfo());
75+
return (bool)$this->scopeConfig->getValue(
76+
self::IS_ENABLE,
77+
ScopeInterface::SCOPE_STORE,
78+
$this->getCurrentStoreInfo()
79+
);
3680
}
3781

38-
public function IsEnableForLogin()
82+
/**
83+
* Function to check enable for login or not
84+
*
85+
* @return boolean
86+
*/
87+
public function isEnableForLogin()
3988
{
4089
if ($this->isEnable()) {
41-
return $this->scopeConfig->getValue(self::ENABLE_LOGIN, ScopeInterface::SCOPE_STORE, $this->getCurrentStoreInfo());
90+
return $this->scopeConfig->getValue(
91+
self::ENABLE_LOGIN,
92+
ScopeInterface::SCOPE_STORE,
93+
$this->getCurrentStoreInfo()
94+
);
4295
}
4396
return false;
4497
}
4598

46-
public function IsEnableForRegistration()
99+
/**
100+
* Function to check enabled for registration
101+
*
102+
* @return boolean
103+
*/
104+
public function isEnableForRegistration()
47105
{
48106
if ($this->isEnable()) {
49-
return $this->scopeConfig->getValue(self::ENABLE_REGISTRATION, ScopeInterface::SCOPE_STORE, $this->getCurrentStoreInfo());
107+
return $this->scopeConfig->getValue(
108+
self::ENABLE_REGISTRATION,
109+
ScopeInterface::SCOPE_STORE,
110+
$this->getCurrentStoreInfo()
111+
);
50112
}
51113
return false;
52114
}
53115

54-
public function IsEnableForEditAccount()
116+
/**
117+
* Function to check enable for edit account
118+
*
119+
* @return boolean
120+
*/
121+
public function isEnableForEditAccount()
55122
{
56123
if ($this->isEnable()) {
57-
return $this->scopeConfig->getValue(self::ENABLE_EDIT_ACCOUNT, ScopeInterface::SCOPE_STORE, $this->getCurrentStoreInfo());
124+
return $this->scopeConfig->getValue(
125+
self::ENABLE_EDIT_ACCOUNT,
126+
ScopeInterface::SCOPE_STORE,
127+
$this->getCurrentStoreInfo()
128+
);
58129
}
59130
return false;
60131
}
61132

133+
/**
134+
* Retrive password iamge
135+
*
136+
* @return boolean|string
137+
*/
62138
public function getShowPasswordImage()
63139
{
64140
if ($this->isEnable()) {
65141
$showpassword = "";
66-
$showpassword = $this->scopeConfig->getValue(self::SHOW_PASSWORD, ScopeInterface::SCOPE_STORE, $this->getCurrentStoreInfo());
142+
$showpassword = $this->scopeConfig->getValue(
143+
self::SHOW_PASSWORD,
144+
ScopeInterface::SCOPE_STORE,
145+
$this->getCurrentStoreInfo()
146+
);
67147
if (!empty($showpassword)) {
68-
$mediaUrl = $this->modelStoreManagerInterface->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA).'Navigate/Icon/';
148+
$mediaUrl = $this->modelStoreManagerInterface->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA).'Navigate/Icon/'; // phpcs:ignore
69149
return $mediaUrl.$showpassword;
70150
}
71151
}
72152
return false;
73153
}
74154

155+
/**
156+
* Retrive hide password image
157+
*
158+
* @return boolean|string
159+
*/
75160
public function getHidePasswordImage()
76161
{
77162
if ($this->isEnable()) {
78163
$hidepassword = "";
79-
$hidepassword = $this->scopeConfig->getValue(self::HIDE_PASSWORD, ScopeInterface::SCOPE_STORE, $this->getCurrentStoreInfo());
164+
$hidepassword = $this->scopeConfig->getValue(
165+
self::HIDE_PASSWORD,
166+
ScopeInterface::SCOPE_STORE,
167+
$this->getCurrentStoreInfo()
168+
);
80169
if (!empty($hidepassword)) {
81-
$mediaUrl = $this->modelStoreManagerInterface->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA).'Navigate/Icon/';
170+
$mediaUrl = $this->modelStoreManagerInterface->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA).'Navigate/Icon/'; // phpcs:ignore
82171
return $mediaUrl.$hidepassword;
83172
}
84173
}

Model/Config/Backend/Hide.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
<?php
2+
/*
3+
* Navigate Commerce
4+
*
5+
* @author Navigate Commerce
6+
* @package Navigate_PasswordHideShow
7+
* @copyright Copyright (c) Navigate (https://www.navigatecommerce.com/)
8+
* @license https://www.navigatecommerce.com/end-user-license-agreement
9+
*/
210

311
namespace Navigate\PasswordHideShow\Model\Config\Backend;
412

@@ -8,7 +16,7 @@ class Hide extends \Magento\Config\Model\Config\Backend\Image
816
* The tail part of directory path for uploading
917
*
1018
*/
11-
const UPLOAD_DIR = 'Navigate/Icon'; // Folder save image
19+
protected const UPLOAD_DIR = 'Navigate/Icon'; // Folder save image
1220

1321
/**
1422
* Return path to directory for upload file

Model/Config/Backend/Show.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
<?php
2+
/*
3+
* Navigate Commerce
4+
*
5+
* @author Navigate Commerce
6+
* @package Navigate_PasswordHideShow
7+
* @copyright Copyright (c) Navigate (https://www.navigatecommerce.com/)
8+
* @license https://www.navigatecommerce.com/end-user-license-agreement
9+
*/
210

311
namespace Navigate\PasswordHideShow\Model\Config\Backend;
412

@@ -8,7 +16,7 @@ class Show extends \Magento\Config\Model\Config\Backend\Image
816
* The tail part of directory path for uploading
917
*
1018
*/
11-
const UPLOAD_DIR = 'Navigate/Icon'; // Folder save image
19+
protected const UPLOAD_DIR = 'Navigate/Icon'; // Folder save image
1220

1321
/**
1422
* Return path to directory for upload file

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"name": "navigate/magento-2-passwordhideshow",
3-
"description": "Form Password HideShow by navigate",
3+
"description": "Magento 2 Form Password HideShow by Navigate",
44
"require": {
55
"navigate/module-core": "^1.0.0",
6-
"php": "~7.0.13|~7.1.0|~7.2.0|~7.3.0|~7.4.0|~8.0.0|~8.1.1"
6+
"php": "~7.0.0|~7.1.0|~7.2.0|~7.3.0|~7.4.0|~8.0.0|~8.1.0|~8.2.0"
77
},
88
"type": "magento2-module",
99
"license": "proprietary",
10-
"version": "1.0.0",
10+
"version": "1.0.1",
1111
"authors": [
1212
{
13-
"name": "Navigate",
13+
"name": "Navigate Commerce",
1414
"email": "support@navigatecommerce.com",
1515
"homepage": "https://www.navigatecommerce.com",
1616
"role": "Technical Support"

etc/acl.xml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
11
<?xml version="1.0"?>
22
<!--
3-
/**
4-
* Navigate
5-
*
6-
* NOTICE OF LICENSE
7-
*
8-
* This source file is subject to the Navigate.com license that is
9-
* available through the world-wide-web at this URL:
10-
* https://www.navigatecommerce.com/LICENSE.txt
11-
*
12-
* DISCLAIMER
13-
*
14-
* Do not edit or add to this file if you wish to upgrade this extension to newer
15-
* version in the future.
16-
*
17-
* @category Navigate
18-
* @package Navigate_PasswordHideShow
19-
* @copyright Copyright (c) Navigate (https://www.navigatecommerce.com/)
20-
* @license https://www.navigatecommerce.com/LICENSE.txt
21-
*/
22-
-->
3+
Navigate Commerce
4+
5+
@author Navigate Commerce
6+
@package Navigate_PasswordHideShow
7+
@copyright Copyright (c) Navigate (https://www.navigatecommerce.com/)
8+
@license https://www.navigatecommerce.com/end-user-license-agreement
9+
-->
10+
2311
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
2412
<acl>
2513
<resources>

etc/adminhtml/menu.xml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
11
<?xml version="1.0"?>
22
<!--
3-
/**
4-
* Navigate Commerce
5-
*
6-
* NOTICE OF LICENSE
7-
*
8-
* This source file is subject to the Navigate.com license that is
9-
* available through the world-wide-web at this URL:
10-
* https://www.navigatecommerce.com/LICENSE.txt
11-
*
12-
* DISCLAIMER
13-
*
14-
* Do not edit or add to this file if you wish to upgrade this extension to newer
15-
* version in the future.
16-
*
17-
* @category Navigate
18-
* @package Navigate_PasswordHideShow
19-
* @copyright Copyright (c) Navigate (https://www.navigatecommerce.com/)
20-
* @license https://www.navigatecommerce.com/LICENSE.txt
21-
*/
22-
-->
3+
Navigate Commerce
4+
5+
@author Navigate Commerce
6+
@package Navigate_PasswordHideShow
7+
@copyright Copyright (c) Navigate (https://www.navigatecommerce.com/)
8+
@license https://www.navigatecommerce.com/end-user-license-agreement
9+
-->
10+
2311
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
2412
<menu>
2513
<add id="Navigate_PasswordHideShow::main" title="Password Show Hide" translate="title" module="Navigate_PasswordHideShow" parent="Navigate_Core::core" sortOrder="350" resource="Navigate_PasswordHideShow::main"/>

etc/adminhtml/routes.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
<?xml version="1.0" ?>
2+
<!--
3+
Navigate Commerce
4+
5+
@author Navigate Commerce
6+
@package Navigate_PasswordHideShow
7+
@copyright Copyright (c) Navigate (https://www.navigatecommerce.com/)
8+
@license https://www.navigatecommerce.com/end-user-license-agreement
9+
-->
10+
211
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
312
<router id="admin">
413
<route id="passwordhideshow" frontName="passwordhideshow">

etc/adminhtml/system.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Navigate Commerce
4+
5+
@author Navigate Commerce
6+
@package Navigate_PasswordHideShow
7+
@copyright Copyright (c) Navigate (https://www.navigatecommerce.com/)
8+
@license https://www.navigatecommerce.com/end-user-license-agreement
9+
-->
10+
211
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
312
<system>
413
<tab id="navigate" translate="Navigate Extensions" sortOrder="100" class="navigate-extensions-tab">

etc/config.xml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
<?xml version="1.0"?>
22
<!--
3-
/**
4-
* Copyright © 2022 Magento. All rights reserved.
5-
* See COPYING.txt for license details.
6-
*/
3+
Navigate Commerce
4+
5+
@author Navigate Commerce
6+
@package Navigate_PasswordHideShow
7+
@copyright Copyright (c) Navigate (https://www.navigatecommerce.com/)
8+
@license https://www.navigatecommerce.com/end-user-license-agreement
79
-->
10+
811
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd">
912
<default>
1013
<passwordhideshow>

etc/frontend/routes.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
<?xml version="1.0"?>
2+
<!--
3+
Navigate Commerce
4+
5+
@author Navigate Commerce
6+
@package Navigate_PasswordHideShow
7+
@copyright Copyright (c) Navigate (https://www.navigatecommerce.com/)
8+
@license https://www.navigatecommerce.com/end-user-license-agreement
9+
-->
10+
211
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
312
<router id="standard">
413
<route id="passwordhideshow" frontName="passwordhideshow">

0 commit comments

Comments
 (0)