ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\User\Profile\ChangeMail\Token Class Reference
+ Collaboration diagram for ILIAS\User\Profile\ChangeMail\Token:

Public Member Functions

 __construct (private readonly int $user_id, private readonly string $current_email, private readonly string $new_email, private readonly int $created_timestamp, private readonly Status $status=Status::Login, private ?string $token=null)
 
 getToken ()
 
 getUserId ()
 
 getCurrentEmail ()
 
 getNewEmail ()
 
 getCreatedTimestamp ()
 
 getStatus ()
 
 isTokenValidForCurrentStatus (\ilSetting $settings)
 
 getUriForStatus (URIBuilder $uri_builder)
 

Private Member Functions

 buildValidToken ()
 

Detailed Description

Definition at line 27 of file Token.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\User\Profile\ChangeMail\Token::__construct ( private readonly int  $user_id,
private readonly string  $current_email,
private readonly string  $new_email,
private readonly int  $created_timestamp,
private readonly Status  $status = Status::Login,
private ?string  $token = null 
)

Definition at line 29 of file Token.php.

36 {
37 $this->token ??= $this->buildValidToken();
38 }

References ILIAS\User\Profile\ChangeMail\Token\buildValidToken().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildValidToken()

ILIAS\User\Profile\ChangeMail\Token::buildValidToken ( )
private

Definition at line 88 of file Token.php.

88 : string
89 {
90 return hash('md5', "{$this->created_timestamp}-{$this->user_id}-{$this->current_email}-{$this->status->value}");
91 }

Referenced by ILIAS\User\Profile\ChangeMail\Token\__construct(), and ILIAS\User\Profile\ChangeMail\Token\isTokenValidForCurrentStatus().

+ Here is the caller graph for this function:

◆ getCreatedTimestamp()

ILIAS\User\Profile\ChangeMail\Token::getCreatedTimestamp ( )

Definition at line 60 of file Token.php.

60 : int
61 {
62 return $this->created_timestamp;
63 }

◆ getCurrentEmail()

ILIAS\User\Profile\ChangeMail\Token::getCurrentEmail ( )

Definition at line 50 of file Token.php.

50 : string
51 {
52 return $this->current_email;
53 }

◆ getNewEmail()

ILIAS\User\Profile\ChangeMail\Token::getNewEmail ( )

Definition at line 55 of file Token.php.

55 : string
56 {
57 return $this->new_email;
58 }

◆ getStatus()

ILIAS\User\Profile\ChangeMail\Token::getStatus ( )

Definition at line 65 of file Token.php.

65 : Status
66 {
67 return $this->status;
68 }

◆ getToken()

ILIAS\User\Profile\ChangeMail\Token::getToken ( )

Definition at line 40 of file Token.php.

40 : string
41 {
42 return $this->token;
43 }
$token
Definition: xapitoken.php:70

References $token.

◆ getUriForStatus()

ILIAS\User\Profile\ChangeMail\Token::getUriForStatus ( URIBuilder  $uri_builder)

Definition at line 79 of file Token.php.

79 : URI
80 {
81 return $uri_builder->build(
83 null,
84 [StaticUrlHandler::CHANGE_EMAIL_OPERATIONS, $this->token]
85 );
86 }
build(string $namespace, ?ReferenceId $reference_id=null, array $additional_parameters=[])

References ILIAS\StaticURL\Builder\URIBuilder\build(), and ILIAS\User\StaticURLHandler\NAMESPACE.

+ Here is the call graph for this function:

◆ getUserId()

ILIAS\User\Profile\ChangeMail\Token::getUserId ( )

Definition at line 45 of file Token.php.

45 : int
46 {
47 return $this->user_id;
48 }

References $user_id.

◆ isTokenValidForCurrentStatus()

ILIAS\User\Profile\ChangeMail\Token::isTokenValidForCurrentStatus ( \ilSetting  $settings)

Definition at line 70 of file Token.php.

70 : bool
71 {
72 if ($this->buildValidToken() === $this->token
73 && time() < $this->created_timestamp + $this->status->getValidity($settings)) {
74 return true;
75 }
76 return false;
77 }

References ILIAS\User\Profile\ChangeMail\Token\buildValidToken().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: