Skip to content

Commit

Permalink
Merge pull request #32690 from owncloud/fix-previousexception-withset…
Browse files Browse the repository at this point in the history
…password-stable10

[stable10] Backport of Fix the token exception classes to avoid infin…
  • Loading branch information
Vincent Petry authored Sep 13, 2018
2 parents 84c3764 + 58f0790 commit ecb918c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
5 changes: 3 additions & 2 deletions lib/public/InvalidUserTokenException.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@
* @since 10.0.10
*/
class InvalidUserTokenException extends UserTokenException {

/**
* InvalidUserTokenException constructor.
*
* @param string $message
* @param int $code
* @since 10.0.10
*/
public function __construct($message = "", $code = 0) {
parent::__construct($message, $code, $this);
public function __construct($message = "", $code = 0, \Exception $previous = null) {
parent::__construct($message, $code, $previous);
}
}
7 changes: 5 additions & 2 deletions lib/public/UserTokenExpiredException.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,17 @@
* @since 10.0.10
*/
class UserTokenExpiredException extends UserTokenException {
/** @var UserTokenExpiredException */
private $previousException;

/**
* UserTokenExpiredException constructor.
*
* @param string $message
* @param int $code
* @since 10.0.10
*/
public function __construct($message = "", $code = 0) {
parent::__construct($message, $code, $this);
public function __construct($message = "", $code = 0, \Exception $previous = null) {
parent::__construct($message, $code, $previous);
}
}
4 changes: 2 additions & 2 deletions lib/public/UserTokenMismatchException.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class UserTokenMismatchException extends UserTokenException {
* @param int $code
* @since 10.0.10
*/
public function __construct($message = "", $code = 0) {
parent::__construct($message, $code, $this);
public function __construct($message = "", $code = 0, \Exception $previous = null) {
parent::__construct($message, $code, $previous);
}
}
2 changes: 1 addition & 1 deletion settings/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ public function setPasswordForm($token, $userId) {
try {
$this->checkPasswordSetToken($token, $userId);
} catch (UserTokenException $e) {
if ($e->getPrevious() instanceof UserTokenExpiredException) {
if ($e instanceof UserTokenExpiredException) {
return new TemplateResponse(
'settings', 'resendtokenbymail',
[
Expand Down

0 comments on commit ecb918c

Please sign in to comment.