Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1d81f54
[WAGMODS-99] Removed deprecated methods and make code comapatible wit…
chirag-d-wagento Oct 30, 2020
fe1d891
[WAGMODS-102] removed the extenal library and directly call the API i…
chirag-d-wagento Nov 2, 2020
f29e33a
[WAGMODS-100] Removed overidden file and add the required customizati…
chirag-d-wagento Nov 3, 2020
f72e1a6
[WAGMODS-104] Added code to implement strict mode
chirag-d-wagento Nov 4, 2020
6c48639
[WAGMODS-106] implement hibp in create password page
chirag-d-wagento Nov 5, 2020
28b5412
[WAGMODS-105] Added code to make ajax call in admin form
chirag-d-wagento Nov 6, 2020
21ae1f4
[WAGEMODS-105] removed typo error
chirag-d-wagento Nov 9, 2020
ddc0923
Implemented code for showing text on creating user from admin form(WA…
wagento-bhavin Dec 3, 2020
6547520
[WAGMODS-108] Added readme template
chirag-d-wagento Dec 8, 2020
1bc1849
[WAGMODS-108] added license file
chirag-d-wagento Dec 8, 2020
88794d8
[WAGMODS-108] Added contribution template
chirag-d-wagento Dec 8, 2020
7668dae
[WAGMODS-108] Added readme template
chirag-d-wagento Dec 8, 2020
6a1b089
[WAGMODS-108] updated license file
chirag-d-wagento Dec 9, 2020
466fda0
[WAGMODS-108] updated contributing file
chirag-d-wagento Dec 9, 2020
ce782c2
[WAGMODS-108] updated contributing file
chirag-d-wagento Dec 9, 2020
b18e734
[WAGEMODS-99] make module compatible with 7.4 and added copyrights in…
chirag-d-wagento Dec 9, 2020
dfdb7cf
[WAGMODS-108] updated readme file
chirag-d-wagento Dec 10, 2020
135f308
[WAGMODS-108] updated readme file
chirag-d-wagento Dec 10, 2020
9899828
[WAGMODS-108] updated readme file
chirag-d-wagento Dec 10, 2020
f17363d
[WAGMODS-108] updated readme file
chirag-d-wagento Dec 10, 2020
0610aaf
[WAGMODS-109] added pull request template
chirag-d-wagento Dec 10, 2020
a99c91d
[WAGMODS-109] move pull request template to .github directory
chirag-d-wagento Dec 10, 2020
83d710a
[WAGMODS-109] added bug report template
chirag-d-wagento Dec 10, 2020
696af39
[WAGMODS-109] added feature template
chirag-d-wagento Dec 10, 2020
ceb9e07
WAGMODS-105 implement command line to check password
ndthanhcom Jan 10, 2021
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
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Technical issue with the Wagento HIBP module.

---

### Preconditions (*)
<!---
Provide the exact Magento version (example: 2.4.0) and any important information on the environment where bug is reproducible.
-->
1.
2.

### Steps to reproduce (*)
<!---
Important: Provide a set of clear steps to reproduce this bug. We can not provide support without clear instructions on how to reproduce.
-->
1.
2.

### Expected result (*)
<!--- Tell us what do you expect to happen. -->
1. [Screenshots, logs or description]
2.

### Actual result (*)
<!--- Tell us what happened instead. Include error messages and issues. -->
1. [Screenshots, logs or description]
2.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Any feature or improvements you would like to see in this module.

---

### Description (*)
<!--- Describe the feature you would like to add. -->

### Expected behavior (*)
<!--- What is the expected behavior of this feature? How is it going to work? -->

### Benefits
<!--- How do you think this feature would improve Module? -->

### Additional information
<!--- What other information can you provide about the desired feature? -->
45 changes: 45 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!---
Thank you for contributing to Wagento Module.
To help us process this pull request we recommend that you add the following information:
- Summary of the pull request,
- Issue(s) related to the changes made,
- Manual testing scenarios
Fields marked with (*) are required. Please don't remove the template.
-->

<!--- Please provide a general summary of the Pull Request in the Title above -->

### Description (*)
<!---
Please provide a description of the changes proposed in the pull request.
Letting us know what has changed and why it needed changing will help us validate this pull request.
-->

### Related Pull Requests
<!-- related pull request placeholder -->

### Fixed Issues (if relevant)
<!---
If relevant, please provide a list of fixed issues in the format wagento/module-hibp#<issue_number>.
There could be 1 or more issues linked here and it will help us find some more information about the reasoning behind this change.
-->

1. Fixes wagento/module-hibp#<issue_number>

### Manual testing scenarios (*)
<!---
Please provide a set of unambiguous steps to test the proposed code change.
Giving us manual testing scenarios will help with the processing and validation process.
-->
1. ...
2. ...

### Questions or comments
<!---
If relevant, here you can ask questions or provide comments on your pull request for the reviewer
For example if you need assistance with writing tests or would like some feedback on one of your development ideas
-->

### Contribution checklist (*)
- [ ] Pull request has a meaningful description of its purpose
- [ ] All commits are accompanied by meaningful commit messages
29 changes: 29 additions & 0 deletions Block/Adminhtml/User.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* Wagento Have I Been Pwned?
*
* Adds test to built-in password strength indicator to check if password has
* been used on other sites.
*
* @package Wagento\HIBP\Controller\Index
* @author Joseph Leedy <joseph@wagento.com>, Chirag Dodia <chirag.dodia@wagento.com>
* @copyright Copyright (c) Wagento Creative LLC. (https://www.wagento.com/)
* @license https://opensource.org/licenses/OSL-3.0.php Open Software License 3.0
*/

namespace Wagento\HIBP\Block\Adminhtml;

use Magento\Backend\Block\Template;

class User extends Template
{
public function getConfig($path)
{
return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
}

public function getBaseUrl()
{
return parent::getBaseUrl();
}
}
47 changes: 47 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Contributing to Wagento HIBP Module
Thank you for your interest in helping Wagento improve this extension. We
welcome any enhancements or bug fixes that you might wish to contribute.

**Note**: If you have a security concern or an issue that you cannot resolve
yourself, please send an e-mail to [support@wagento.com] instead of opening a
GitHub ticket.
## Things to Know

* At Wagento, we follow the [Git Flow] methodology when adding new features.
* We follow the [PSR-1], [PSR-2], and [PSR-12] coding standards.
* Please be civil and do not harass or abuse any members of the Wagento staff
or other contributors.
* Wagento reserves the right to decline any contributions which do not fit
our guidelines or vision for the extension.
* All code submitted becomes the sole property of Wagento and is subject to our
copyright with or without attribution.

## Important Steps to Follow

1. [Open a GitHub issue][issue] describing the enhancement or fix that you are
contributing.
2. Create a fork of [our GitHub repository][repository] in your GitHub account.
3. Create a feature branch to contain your contribution.
4. Develop your contribution and test it thoroughly under the Magento versions
supported by the extension (see the [README] for a list).
5. Add unit tests, integration tests, and functional tests to prove that your
contribution functions properly and does not break anything.
6. [Submit a Pull Request][pr] referencing the ticket you created in Step 1.

## Follow-up

After you submit your contribution, we will review it when time permits. Once we
do so, we will add a comment to the Pull Request letting you know what needs to
be added, corrected, or otherwise changed. When we are satisfied, we will merge
your changes and add your name to the Credits section of the [README] if
merited.

[support@wagento.com]: mailto:support@wagento.com?subject=[HIBP%20Module]%20
[Git Flow]: http://nvie.com/posts/a-successful-git-branching-model/
[PSR-1]: https://www.php-fig.org/psr/psr-1/
[PSR-2]: https://www.php-fig.org/psr/psr-2/
[PSR-12]: https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md
[repository]: https://github.com/wagento/module-hibp
[issue]: https://github.com/wagento/module-hibp/issues
[pr]: https://github.com/wagento/module-hibp/compare
[README]: ./README.md
69 changes: 69 additions & 0 deletions Console/Command/HIBP.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php
/**
* Wagento Have I Been Pwned?
*
* Adds test to built-in password strength indicator to check if password has
* been used on other sites.
*
* @package Wagento\HIBP\Console\Command
* @author Joseph Leedy <joseph@wagento.com>, Chirag Dodia <chirag.dodia@wagento.com>, Thanh Nguyen <leo@wagento.com>
* @copyright Copyright (c) Wagento Creative LLC. (https://www.wagento.com/)
* @license https://opensource.org/licenses/OSL-3.0.php Open Software License 3.0
*/
declare(strict_types=1);

namespace Wagento\HIBP\Console\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Wagento\HIBP\Model\Hibp as HibpModel;

class HIBP extends Command
{
const PASSWORD = 'password';

/**
* Command Line class HIBP constructor.
* @param Hibp $hibp
*/
public function __construct(
HibpModel $hibp
) {
$this->hibp = $hibp;
parent::__construct();
}

protected function configure()
{
$this->setName('hibp:check-password')
->setDescription('Wagento Have I Been Pwned - Check Password')
->addArgument(
self::PASSWORD,
InputArgument::REQUIRED,
'Password To Check'
);

parent::configure();
}

/**
* check input password from command line
* @param InputInterface
* @param OutputInterface
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$password = $input->getArgument(self::PASSWORD);

$isPwnedPassword = $this->hibp->isPwnedPassword($password);
$count = $this->hibp->count();
if ($isPwnedPassword && $count) {
$output->writeln("Your Password has been Pwned {$count} times !");
}
else {
$output->writeln("Your Password hasn't been Pwned !");
}
}
}
47 changes: 31 additions & 16 deletions Controller/Index/AjaxPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,58 +6,73 @@
* been used on other sites.
*
* @package Wagento\HIBP\Controller\Index
* @author Joseph Leedy <joseph@wagento.com>
* @author Joseph Leedy <joseph@wagento.com>, Chirag Dodia <chirag.dodia@wagento.com>
* @copyright Copyright (c) Wagento Creative LLC. (https://www.wagento.com/)
* @license https://opensource.org/licenses/OSL-3.0.php Open Software License 3.0
*/
declare(strict_types=1);

namespace Wagento\HIBP\Controller\Index;

use Dragonbe\Hibp\HibpFactory;
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;
use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\Exception\NotFoundException;
use Wagento\HIBP\Model\Hibp;

/**
* Ajax POST Controller
*
* @package Wagento\HIBP\Controller\Index
* @author Joseph Leedy <joseph@wagento.com>
*/
class AjaxPost extends Action
class AjaxPost implements HttpPostActionInterface
{
/**
* @var \Dragonbe\Hibp\HibpFactory
* @var RequestInterface
*/
protected $request;
/**
* @var ResultFactory
*/
protected $resultFactory;
/**
* @var Hibp
*/
private $hibpFactory;
protected $hibp;

/**
* AjaxPost constructor.
* @param Hibp $hibp
* @param RequestInterface $request
* @param ResultFactory $resultFactory
*/
public function __construct(
Context $context,
HibpFactory $hibpFactory
Hibp $hibp,
RequestInterface $request,
ResultFactory $resultFactory
) {
parent::__construct($context);

$this->hibpFactory = $hibpFactory;
$this->hibp = $hibp;
$this->request = $request;
$this->resultFactory = $resultFactory;
}

/**
* {@inheritdoc}
*/
public function execute()
{
if (!$this->getRequest()->isAjax() || !$this->getRequest()->isPost()) {
if (!$this->request->isAjax() || !$this->request->isPost()) {
throw new NotFoundException(__('Action is not available.'));
}

$hibp = $this->hibpFactory::create();
$password = $this->getRequest()->getPost('password');
$hibp = $this->hibp;
$password = $this->request->getPost('password');
$resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);

$resultJson->setData([
'pwned' => $hibp->isPwnedPassword($password),
'count' => count($hibp)
'count' => $hibp->count()
]);

return $resultJson;
Expand Down
Loading