Add nullable return type when checking if OTP is enabled.

Fixes #17
parent 542517af
Pipeline #2893 passed with stage
in 1 minute and 19 seconds
......@@ -170,9 +170,9 @@ class Wp_Otp_Public {
*
* @param Wp_Otp_User_Meta $user_meta_data
*
* @return TOTP
* @return null|TOTP
*/
private function get_otp_if_enabled( $user_meta_data ): TOTP {
private function get_otp_if_enabled( $user_meta_data ): ?TOTP {
if ( $user_meta_data->get( 'enabled' ) && null !== $user_meta_data->get( 'secret' ) ) {
return TOTP::create( $user_meta_data->get( 'secret' ) );
}
......
......@@ -4,7 +4,7 @@ Donate link: https://noplanman.ch/donate
Tags: login, 2fa, two factor, otp, totp, one time password, security, recovery, google authenticator
Requires at least: 4.6
Tested up to: 5.3
Stable tag: 0.4.0
Stable tag: 0.4.1
Requires PHP: 7.1
Author URI: https://noplanman.ch
Plugin URI: https://git.feneas.org/noplanman/wp-otp
......@@ -93,6 +93,9 @@ This means that you will need to add your OTP (or recovery) code at the end of y
== Changelog ==
= 0.4.1 =
* Fix nullable return type when checking if OTP is enabled.
= 0.4.0 =
* Drop all custom i18n and rely on translate.wordpress.org.
* Minimum requirements are now WP 4.6 and PHP 7.1.
......
......@@ -3,7 +3,7 @@
* Plugin Name: WP-OTP
* Plugin URI: https://wordpress.org/plugins/wp-otp/
* Description: WP-OTP adds 2 Factor Authentication using TOTP. (Based on "WP Secure Login" by Brijesh Kothari)
* Version: 0.4.0
* Version: 0.4.1
* Author: Armando Lüscher
* Author URI: https://noplanman.ch
* License: GPLv2 or later
......@@ -21,7 +21,7 @@ defined( 'WPINC' ) || exit;
// Define constants.
define( 'WP_OTP_SLUG', 'wp-otp' );
define( 'WP_OTP_VERSION', '0.4.0' );
define( 'WP_OTP_VERSION', '0.4.1' );
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/includes/class-wp-otp.php';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment