Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions providers/class-two-factor-backup-codes.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ protected function __construct() {
/**
* Register the rest-api endpoints required for this provider.
*
* @since 0.8.0
*
* @codeCoverageIgnore
*/
public function register_rest_routes() {
Expand Down Expand Up @@ -219,6 +221,8 @@ public function user_options( $user ) {
/**
* Get the backup code length for a user.
*
* @since 0.11.0
*
* @param WP_User $user User object.
*
* @return int Number of characters.
Expand Down Expand Up @@ -331,6 +335,8 @@ public function rest_generate_codes( $request ) {
/**
* Returns the number of unused codes for the specified user
*
* @since 0.2.0
*
* @param WP_User $user WP_User object of the logged-in user.
* @return int $int The number of unused codes remaining
*/
Expand Down Expand Up @@ -435,6 +441,8 @@ public function delete_code( $user, $code_hashed ) {
/**
* Return user meta keys to delete during plugin uninstall.
*
* @since 0.10.0
*
* @return array
*/
public static function uninstall_user_meta_keys() {
Expand Down
18 changes: 18 additions & 0 deletions providers/class-two-factor-email.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public function get_alternative_provider_label() {
/**
* Get the email token length.
*
* @since 0.11.0
*
* @return int Email token string length.
*/
private function get_token_length() {
Expand Down Expand Up @@ -99,6 +101,8 @@ public function generate_token( $user_id ) {
/**
* Check if user has a valid token already.
*
* @since 0.2.0
*
* @param int $user_id User ID.
* @return boolean If user has a valid email token.
*/
Expand All @@ -115,6 +119,8 @@ public function user_has_token( $user_id ) {
/**
* Has the user token validity timestamp expired.
*
* @since 0.6.0
*
* @param integer $user_id User ID.
*
* @return boolean
Expand All @@ -134,6 +140,8 @@ public function user_token_has_expired( $user_id ) {
/**
* Get the lifetime of a user token in seconds.
*
* @since 0.6.0
*
* @param integer $user_id User ID.
*
* @return integer|null Return `null` if the lifetime can't be measured.
Expand All @@ -151,6 +159,8 @@ public function user_token_lifetime( $user_id ) {
/**
* Return the token time-to-live for a user.
*
* @since 0.6.0
*
* @param integer $user_id User ID.
*
* @return integer
Expand Down Expand Up @@ -182,6 +192,8 @@ public function user_token_ttl( $user_id ) {
/**
* Get the authentication token for the user.
*
* @since 0.2.0
*
* @param int $user_id User ID.
*
* @return string|boolean User token or `false` if no token found.
Expand Down Expand Up @@ -237,6 +249,8 @@ public function delete_token( $user_id ) {
/**
* Get the client IP address for the current request.
*
* @since 0.15.0
*
* Note that the IP address is used only for information purposes
* and is expected to be configured correctly, if behind proxy.
*
Expand Down Expand Up @@ -359,6 +373,8 @@ public function authentication_page( $user ) {
* Send the email code if missing or requested. Stop the authentication
* validation if a new token has been generated and sent.
*
* @since 0.2.0
*
* @param WP_User $user WP_User object of the logged-in user.
* @return boolean
*/
Expand Down Expand Up @@ -427,6 +443,8 @@ public function user_options( $user ) {
/**
* Return user meta keys to delete during plugin uninstall.
*
* @since 0.10.0
*
* @return array
*/
public static function uninstall_user_meta_keys() {
Expand Down
12 changes: 12 additions & 0 deletions providers/class-two-factor-provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ abstract public function authentication_page( $user );
* Return `true` to prevent the authentication and render the
* authentication page.
*
* @since 0.2.0
*
* @param WP_User $user WP_User object of the logged-in user.
* @return boolean
*/
Expand All @@ -118,6 +120,8 @@ abstract public function validate_authentication( $user );
/**
* Whether this Two Factor provider is configured and available for the user specified.
*
* @since 0.7.0
*
* @param WP_User $user WP_User object of the logged-in user.
* @return boolean
*/
Expand All @@ -126,6 +130,8 @@ abstract public function is_available_for_user( $user );
/**
* If this provider should be available for the user.
*
* @since 0.13.0
*
* @param WP_User|int $user WP_User object, user ID or null to resolve the current user.
*
* @return bool
Expand Down Expand Up @@ -159,6 +165,8 @@ public static function get_code( $length = 8, $chars = '1234567890' ) {
/**
* Sanitizes a numeric code to be used as an auth code.
*
* @since 0.8.0
*
* @param string $field The _REQUEST field to check for the code.
* @param int $length The valid expected length of the field.
* @return false|string Auth code on success, false if the field is not set or not expected length.
Expand All @@ -182,6 +190,8 @@ public static function sanitize_code_from_request( $field, $length = 0 ) {
/**
* Return the user meta keys that need to be deletated on plugin uninstall.
*
* @since 0.10.0
*
* @return array
*/
public static function uninstall_user_meta_keys() {
Expand All @@ -191,6 +201,8 @@ public static function uninstall_user_meta_keys() {
/**
* Return the option keys that need to be deleted on plugin uninstall.
*
* @since 0.10.0
*
* Note: this method doesn't have access to the instantiated provider object.
*
* @return array
Expand Down
Loading