Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a8ab37a authored by Ronak Patel's avatar Ronak Patel
Browse files

int

parent d6181c80
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 	 * @since 23.0.0
 	 */
-	public function create(IUser $user, string $subject, string $passwordPrefix = ''): string;
+	public function create(IUser $user, string $subject, string $passwordPrefix = '', int $expirationTime = ''): string;
+	public function create(IUser $user, string $subject, string $passwordPrefix = '', int $expirationTime = 0): string;
 
 	/**
 	 * Deletes the token identified by the provided parameters
+2 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 	}
 
-	public function create(IUser $user, string $subject, string $passwordPrefix = ''): string {
+	public function create(IUser $user, string $subject, string $passwordPrefix = '', int $expirationTime = ''): string {
+	public function create(IUser $user, string $subject, string $passwordPrefix = '', int $expirationTime = 0): string {
 		$token = $this->secureRandom->generate(
 			21,
 			ISecureRandom::CHAR_DIGITS.
@@ -14,7 +14,7 @@
 			'subject' => $subject,
 			'pp' => $passwordPrefix,
-			'notBefore' => $this->timeFactory->getTime() + self::TOKEN_LIFETIME * 2, // multiply to provide a grace period
+			'notBefore' => ($expirationTime !== '') ? $expirationTime : $this->timeFactory->getTime() + self::TOKEN_LIFETIME * 2, // multiply to provide a grace period
+			'notBefore' => ($expirationTime > 0) ? $expirationTime : $this->timeFactory->getTime() + self::TOKEN_LIFETIME * 2, // multiply to provide a grace period
 		]);
 		$this->jobList->add(CleanUpJob::class, $jobArgs);