-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forgot password with username or email or another property (#32)
* reset password with username * resolve discussions on reset password with username * add unit tests on reset password with username * update configuration * return after resetPassword * resolve discussions * Fix BC Break * Fix code review * Fix tests * Fix code review * PHP-CS-Fixer * Fix phpunit test * Fix tests * Fix tests * Fix Code review * Fix Conflicts with master * use strict mode for in_array
- Loading branch information
1 parent
f78e02a
commit c0d2208
Showing
16 changed files
with
216 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the CoopTilleulsForgotPasswordBundle package. | ||
* | ||
* (c) Vincent Chalamon <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace CoopTilleuls\ForgotPasswordBundle\Exception; | ||
|
||
use Symfony\Component\HttpKernel\Exception\HttpException; | ||
|
||
final class InvalidJsonHttpException extends HttpException implements JsonHttpExceptionInterface | ||
{ | ||
public function __construct() | ||
{ | ||
parent::__construct(400, 'Invalid JSON data.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the CoopTilleulsForgotPasswordBundle package. | ||
* | ||
* (c) Vincent Chalamon <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace CoopTilleuls\ForgotPasswordBundle\Exception; | ||
|
||
use Symfony\Component\HttpKernel\Exception\HttpException; | ||
|
||
final class NoParameterException extends HttpException implements JsonHttpExceptionInterface | ||
{ | ||
public function __construct() | ||
{ | ||
parent::__construct(400, 'No parameter sent.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the CoopTilleulsForgotPasswordBundle package. | ||
* | ||
* (c) Vincent Chalamon <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace CoopTilleuls\ForgotPasswordBundle\Exception; | ||
|
||
use Symfony\Component\HttpKernel\Exception\HttpException; | ||
|
||
final class UnauthorizedFieldException extends HttpException implements JsonHttpExceptionInterface | ||
{ | ||
public function __construct($propertyName) | ||
{ | ||
parent::__construct(400, sprintf('The parameter "%s" is not authorized in your configuration.', $propertyName)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,8 +85,12 @@ public function iHaveAnExpiredToken() | |
|
||
/** | ||
* @Then I reset my password | ||
* @Then I reset my password with my :propertyName ":value" | ||
* | ||
* @param string $propertyName | ||
* @param string $value | ||
*/ | ||
public function iResetMyPassword() | ||
public function IResetMyPassword($propertyName = 'email', $value = '[email protected]') | ||
{ | ||
$this->createUser(); | ||
|
||
|
@@ -97,11 +101,12 @@ public function iResetMyPassword() | |
[], | ||
[], | ||
['CONTENT_TYPE' => 'application/json'], | ||
<<<'JSON' | ||
sprintf(<<<'JSON' | ||
{ | ||
"email": "[email protected]" | ||
"%s": "%s" | ||
} | ||
JSON | ||
, $propertyName, $value) | ||
); | ||
} | ||
|
||
|
@@ -194,9 +199,9 @@ public function iResetMyPasswordUsingInvalidEmailAddress() | |
} | ||
|
||
/** | ||
* @Then I reset my password using no email address | ||
* @Then I reset my password using no parameter | ||
*/ | ||
public function iResetMyPasswordUsingNoEmailAddress() | ||
public function iResetMyPasswordUsingNoParameter() | ||
{ | ||
$this->client->request('POST', '/forgot_password/'); | ||
} | ||
|
@@ -314,6 +319,7 @@ private function createUser() | |
{ | ||
$user = new User(); | ||
$user->setEmail('[email protected]'); | ||
$user->setUsername('JohnDoe'); | ||
$user->setPassword('password'); | ||
$this->doctrine->getManager()->persist($user); | ||
$this->doctrine->getManager()->flush(); | ||
|
Oops, something went wrong.