@@ -18,7 +18,6 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * Get system resources name. |
| 20 | 20 | * |
| 21 | - * @param string $rootDir Root directory path. |
|
| 22 | 21 | * |
| 23 | 22 | * @return array Array of system resources. |
| 24 | 23 | */ |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | use Webcook\Cms\SecurityBundle\Controller\PublicControllerInterface; |
| 13 | 13 | use Symfony\Component\HttpFoundation\Request; |
| 14 | 14 | use Symfony\Component\HttpFoundation\Response; |
| 15 | -use Symfony\Component\Security\Core\Security; |
|
| 16 | 15 | use Webcook\Cms\SecurityBundle\Entity\User; |
| 17 | 16 | use Nelmio\ApiDocBundle\Annotation\ApiDoc; |
| 18 | 17 | use FOS\RestBundle\Controller\Annotations\Post; |
@@ -24,14 +24,14 @@ discard block |
||
| 24 | 24 | class LoginController extends BaseRestController implements PublicControllerInterface |
| 25 | 25 | { |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Send an email with a link to reset user's password. |
|
| 29 | - * |
|
| 30 | - * @ApiDoc( |
|
| 31 | - * description="Send an email with a link to reset user's password." |
|
| 32 | - * ) |
|
| 33 | - * @Post("password/email/reset", options={"i18n"=false}) |
|
| 34 | - */ |
|
| 27 | + /** |
|
| 28 | + * Send an email with a link to reset user's password. |
|
| 29 | + * |
|
| 30 | + * @ApiDoc( |
|
| 31 | + * description="Send an email with a link to reset user's password." |
|
| 32 | + * ) |
|
| 33 | + * @Post("password/email/reset", options={"i18n"=false}) |
|
| 34 | + */ |
|
| 35 | 35 | public function resetPasswordEmailAction(Request $request): Response |
| 36 | 36 | { |
| 37 | 37 | $email = $request->request->get('email'); |
@@ -66,14 +66,14 @@ discard block |
||
| 66 | 66 | return $this->handleView($view); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * Reset password view. |
|
| 71 | - * |
|
| 72 | - * @ApiDoc( |
|
| 73 | - * description="Reset password view." |
|
| 74 | - * ) |
|
| 75 | - * @Get("password/reset", options={"i18n"=false}) |
|
| 76 | - */ |
|
| 69 | + /** |
|
| 70 | + * Reset password view. |
|
| 71 | + * |
|
| 72 | + * @ApiDoc( |
|
| 73 | + * description="Reset password view." |
|
| 74 | + * ) |
|
| 75 | + * @Get("password/reset", options={"i18n"=false}) |
|
| 76 | + */ |
|
| 77 | 77 | public function resetPasswordGetAction(Request $request): Response |
| 78 | 78 | { |
| 79 | 79 | $token = $request->query->get('token'); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $email = $request->request->get('email'); |
| 38 | 38 | $user = $this->getEntityManager()->getRepository('Webcook\Cms\SecurityBundle\Entity\User')->findOneBy(array('email'=> $email)); |
| 39 | 39 | |
| 40 | - if($user === null) { |
|
| 40 | + if ($user === null) { |
|
| 41 | 41 | $view = $this->getViewWithMessage(null, 404, 'This email does not exist. Please enter a valid email.'); |
| 42 | 42 | return $this->handleView($view); |
| 43 | 43 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | ->setContentType("text/html"); |
| 58 | 58 | |
| 59 | 59 | $result = $this->get('mailer')->send($message); |
| 60 | - if($result) { |
|
| 60 | + if ($result) { |
|
| 61 | 61 | $view = $this->getViewWithMessage(null, 200, 'Your password reset link was sent to your e-mail address.'); |
| 62 | 62 | } else { |
| 63 | 63 | $view = $this->getViewWithMessage(null, 400, 'Cannot send an email.'); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | $token = $request->query->get('token'); |
| 80 | 80 | $user = $this->getEntityManager()->getRepository('Webcook\Cms\SecurityBundle\Entity\User')->findOneBy(array('passwordResetToken'=> $token)); |
| 81 | - if($user === null || empty($token)){ |
|
| 81 | + if ($user === null || empty($token)) { |
|
| 82 | 82 | $view = $this->getViewWithMessage(null, 404, 'This token is invalid.'); |
| 83 | 83 | return $this->handleView($view); |
| 84 | 84 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $view = $this->getViewWithMessage(null, 400, 'This token has expired.'); |
| 92 | 92 | $diffInSeconds = $dateDiff->i * 60 + $dateDiff->s; |
| 93 | - if($diffInSeconds < 600 && $dateDiff->y == 0 && $dateDiff->m == 0 && $dateDiff->d == 0 && $dateDiff->h == 0) { |
|
| 93 | + if ($diffInSeconds < 600 && $dateDiff->y == 0 && $dateDiff->m == 0 && $dateDiff->d == 0 && $dateDiff->h == 0) { |
|
| 94 | 94 | $view = $this->getViewWithMessage(null, 200, 'Please enter your new password.'); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -110,14 +110,14 @@ discard block |
||
| 110 | 110 | $password = $request->request->get('password'); |
| 111 | 111 | $repeatPassword = $request->request->get('repeatPassword'); |
| 112 | 112 | $token = $request->request->get('token'); |
| 113 | - if(empty($password) || empty($repeatPassword) || empty($token)){ |
|
| 113 | + if (empty($password) || empty($repeatPassword) || empty($token)) { |
|
| 114 | 114 | $view = $this->getViewWithMessage(null, 400, 'Passwords and token can\'t be empty.'); |
| 115 | 115 | return $this->handleView($view); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if($password == $repeatPassword) { |
|
| 118 | + if ($password == $repeatPassword) { |
|
| 119 | 119 | $user = $this->getEntityManager()->getRepository('Webcook\Cms\SecurityBundle\Entity\User')->findOneBy(array('passwordResetToken'=> $token)); |
| 120 | - if($user === null){ |
|
| 120 | + if ($user === null) { |
|
| 121 | 121 | $view = $this->getViewWithMessage(null, 404, 'This token is invalid.'); |
| 122 | 122 | return $this->handleView($view); |
| 123 | 123 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | /** |
| 137 | 137 | * Return form if is not valid, otherwise process form and return setting object. |
| 138 | 138 | * |
| 139 | - * @param [type] $setting |
|
| 139 | + * @param Setting $setting |
|
| 140 | 140 | * @param string $method |
| 141 | 141 | * |
| 142 | 142 | * @return [type] |
@@ -167,8 +167,6 @@ discard block |
||
| 167 | 167 | * |
| 168 | 168 | * |
| 169 | 169 | * @param int $id [description] |
| 170 | - * @param int $expectedVersion [description] |
|
| 171 | - * @param boolean $saveLockVersion [description] |
|
| 172 | 170 | * |
| 173 | 171 | * @return Setting [description] |
| 174 | 172 | */ |
@@ -17,8 +17,6 @@ |
||
| 17 | 17 | use FOS\RestBundle\Controller\Annotations\Get; |
| 18 | 18 | use FOS\RestBundle\Controller\Annotations\Post; |
| 19 | 19 | use FOS\RestBundle\Controller\Annotations\Put; |
| 20 | -use FOS\RestBundle\Controller\Annotations\Delete; |
|
| 21 | -use Doctrine\DBAL\LockMode; |
|
| 22 | 20 | |
| 23 | 21 | /** |
| 24 | 22 | * REST api controller - setting management. |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | /** |
| 179 | 179 | * Return form if is not valid, otherwise process form and return role object. |
| 180 | 180 | * |
| 181 | - * @param [type] $user |
|
| 181 | + * @param User $user |
|
| 182 | 182 | * @param string $method |
| 183 | 183 | * |
| 184 | 184 | * @return [type] |
@@ -223,7 +223,6 @@ discard block |
||
| 223 | 223 | * |
| 224 | 224 | * @param int $id [description] |
| 225 | 225 | * @param int $expectedVersion [description] |
| 226 | - * @param boolean $saveLockVersion [description] |
|
| 227 | 226 | * |
| 228 | 227 | * @return User [description] |
| 229 | 228 | */ |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | /** |
| 59 | 59 | * Add admin user. |
| 60 | 60 | * |
| 61 | - * @param [type] $manager [description] |
|
| 61 | + * @param ObjectManager $manager [description] |
|
| 62 | 62 | */ |
| 63 | 63 | private function addAdmin($manager) |
| 64 | 64 | { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | /** |
| 82 | 82 | * Add editor user. |
| 83 | 83 | * |
| 84 | - * @param [type] $manager [description] |
|
| 84 | + * @param ObjectManager $manager [description] |
|
| 85 | 85 | */ |
| 86 | 86 | private function addEditor($manager) |
| 87 | 87 | { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | /** |
| 105 | 105 | * Add Test user. |
| 106 | 106 | * |
| 107 | - * @param [type] $manager [description] |
|
| 107 | + * @param ObjectManager $manager [description] |
|
| 108 | 108 | */ |
| 109 | 109 | private function addTestUser($manager) |
| 110 | 110 | { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | /** |
| 74 | 74 | * Sets the value of name. |
| 75 | 75 | * |
| 76 | - * @param mixed $name the name |
|
| 76 | + * @param string $name the name |
|
| 77 | 77 | * |
| 78 | 78 | * @return self |
| 79 | 79 | */ |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | /** |
| 88 | 88 | * Sets the value of role. |
| 89 | 89 | * |
| 90 | - * @param mixed $role the role |
|
| 90 | + * @param string $role the role |
|
| 91 | 91 | * |
| 92 | 92 | * @return self |
| 93 | 93 | */ |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @param [type] $attribute [description] |
| 70 | 70 | * |
| 71 | - * @return boolean [description] |
|
| 71 | + * @return boolean|null [description] |
|
| 72 | 72 | */ |
| 73 | 73 | public function isGranted($attribute) |
| 74 | 74 | { |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | /** |
| 99 | 99 | * Gets the value of view. |
| 100 | 100 | * |
| 101 | - * @return mixed |
|
| 101 | + * @return boolean |
|
| 102 | 102 | */ |
| 103 | 103 | public function getView() |
| 104 | 104 | { |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | /** |
| 123 | 123 | * Gets the value of edit. |
| 124 | 124 | * |
| 125 | - * @return mixed |
|
| 125 | + * @return boolean |
|
| 126 | 126 | */ |
| 127 | 127 | public function getEdit() |
| 128 | 128 | { |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | /** |
| 133 | 133 | * Sets the value of edit. |
| 134 | 134 | * |
| 135 | - * @param mixed $edit the edit |
|
| 135 | + * @param boolean $edit the edit |
|
| 136 | 136 | * |
| 137 | 137 | * @return self |
| 138 | 138 | */ |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | /** |
| 147 | 147 | * Gets the value of delete. |
| 148 | 148 | * |
| 149 | - * @return mixed |
|
| 149 | + * @return boolean |
|
| 150 | 150 | */ |
| 151 | 151 | public function getDelete() |
| 152 | 152 | { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | /** |
| 157 | 157 | * Sets the value of delete. |
| 158 | 158 | * |
| 159 | - * @param mixed $delete the delete |
|
| 159 | + * @param boolean $delete the delete |
|
| 160 | 160 | * |
| 161 | 161 | * @return self |
| 162 | 162 | */ |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | /** |
| 219 | 219 | * Gets the Insert permission. |
| 220 | 220 | * |
| 221 | - * @return mixed |
|
| 221 | + * @return boolean |
|
| 222 | 222 | */ |
| 223 | 223 | public function getInsert() |
| 224 | 224 | { |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | /** |
| 229 | 229 | * Sets the Insert permission. |
| 230 | 230 | * |
| 231 | - * @param mixed $insert the insert |
|
| 231 | + * @param boolean $insert the insert |
|
| 232 | 232 | * |
| 233 | 233 | * @return self |
| 234 | 234 | */ |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | /** |
| 208 | 208 | * Sets the value of email. |
| 209 | 209 | * |
| 210 | - * @param mixed $email the email |
|
| 210 | + * @param string $email the email |
|
| 211 | 211 | * |
| 212 | 212 | * @return self |
| 213 | 213 | */ |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | /** |
| 246 | 246 | * Sets the value of username. |
| 247 | 247 | * |
| 248 | - * @param mixed $username the username |
|
| 248 | + * @param string $username the username |
|
| 249 | 249 | * |
| 250 | 250 | * @return self |
| 251 | 251 | */ |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | /** |
| 307 | 307 | * Gets the value of settings. |
| 308 | 308 | * |
| 309 | - * @return mixed |
|
| 309 | + * @return ArrayCollection |
|
| 310 | 310 | */ |
| 311 | 311 | public function getSettings() |
| 312 | 312 | { |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | /** |
| 336 | 336 | * Sets the value of password reset token. |
| 337 | 337 | * |
| 338 | - * @param mixed $passwordResetToken the passwordResetToken |
|
| 338 | + * @param null|string $passwordResetToken the passwordResetToken |
|
| 339 | 339 | * |
| 340 | 340 | * @return self |
| 341 | 341 | */ |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | /** |
| 360 | 360 | * Sets the value of password reset token. |
| 361 | 361 | * |
| 362 | - * @param mixed $passwordResetExpiration the passwordResetExpiration |
|
| 362 | + * @param null|\DateTime $passwordResetExpiration the passwordResetExpiration |
|
| 363 | 363 | * |
| 364 | 364 | * @return self |
| 365 | 365 | */ |
@@ -322,11 +322,11 @@ |
||
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - /** |
|
| 326 | - * Get passwordResetToken. |
|
| 327 | - * |
|
| 328 | - * @inheritDoc |
|
| 329 | - */ |
|
| 325 | + /** |
|
| 326 | + * Get passwordResetToken. |
|
| 327 | + * |
|
| 328 | + * @inheritDoc |
|
| 329 | + */ |
|
| 330 | 330 | public function getPasswordResetToken() |
| 331 | 331 | { |
| 332 | 332 | return $this->passwordResetToken; |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * @ORM\Table(name="SecurityUser") |
| 20 | 20 | * @ORM\Entity(repositoryClass="Webcook\Cms\SecurityBundle\Entity\UserRepository") |
| 21 | 21 | */ |
| 22 | -class User extends BasicEntity implements UserInterface,\Serializable |
|
| 22 | +class User extends BasicEntity implements UserInterface, \Serializable |
|
| 23 | 23 | { |
| 24 | 24 | /** |
| 25 | 25 | * Username of the user. |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | public function getSettingsByName($name) |
| 317 | 317 | { |
| 318 | 318 | foreach ($this->getSettings() as &$value) { |
| 319 | - if($value->getName() == $name) { |
|
| 319 | + if ($value->getName() == $name) { |
|
| 320 | 320 | return $value; |
| 321 | 321 | } |
| 322 | 322 | } |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | /** |
| 83 | 83 | * {@inheritdoc} |
| 84 | 84 | * |
| 85 | - * @param [type] $class [description] |
|
| 85 | + * @param string $class [description] |
|
| 86 | 86 | * @return [type] [description] |
| 87 | 87 | */ |
| 88 | 88 | public function supportsClass($class) |