Skip to content

Commit

Permalink
Merge pull request #39 from imgeng/bugfix/settings
Browse files Browse the repository at this point in the history
= 1.2.3 =
  • Loading branch information
jonarnes authored Aug 8, 2024
2 parents 9d23461 + 519fe20 commit 3c30044
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
4 changes: 2 additions & 2 deletions image-cdn.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
* Requires PHP: 7.4
* Text Domain: image-cdn
* License: GPLv2 or later
* Version: 1.2.2
* Version: 1.2.3
*/

// Update this then you update "Requires at least" above!
define( 'IMAGE_CDN_MIN_WP', '5.3' );

// Update this when you update the "Version" above!
define( 'IMAGE_CDN_VERSION', '1.2.2' );
define( 'IMAGE_CDN_VERSION', '1.2.3' );

if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require_once( __DIR__ . '/vendor/autoload.php' );
Expand Down
13 changes: 13 additions & 0 deletions imageengine/class-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,16 +425,19 @@ public static function register() {
if ( ! wp_verify_nonce( $nonce, 'image_cdn_register_nonce' ) || ! current_user_can( 'administrator' ) ) {
self::add_error( __( 'Unauthorized', 'image-cdn' ), 'register' );
wp_redirect( add_query_arg( 'register-error', 'Unauthorized', admin_url( '/admin.php?page=image_cdn' ) ) );
exit;
}

if ( ! isset( $_POST['register_username'] ) || ! is_email( $_POST['register_username'] ) ) {
self::add_error( __( 'Invalid username', 'image-cdn' ), 'register' );
wp_redirect( admin_url( '/admin.php?page=image_cdn' ) );
exit;
}

if ( ! isset( $_POST['register_password'] ) ) {
self::add_error( __( 'Invalid password', 'image-cdn' ), 'register' );
wp_redirect( admin_url( '/admin.php?page=image_cdn' ) );
exit;
}

try {
Expand All @@ -444,10 +447,12 @@ public static function register() {
if ( is_string( $message ) ) {
self::add_success( $message );
wp_redirect( admin_url( '/admin.php?page=image_cdn' ) );
exit;
}
} catch ( \Exception $e ) {
self::add_error( __( 'An error occurred!', 'image-cdn' ), 'register' );
wp_redirect( admin_url( '/admin.php?page=image_cdn' ) );
exit;
}
}

Expand All @@ -459,16 +464,19 @@ public static function login() {
if ( ! wp_verify_nonce( $nonce, 'image_cdn_login_nonce' ) || ! current_user_can( 'administrator' ) ) {
self::add_error( __( 'Unauthorized', 'image-cdn' ), 'login' );
wp_redirect( admin_url( '/admin.php?page=image_cdn' ) );
exit;
}

if ( ! isset( $_POST['login_username'] ) || ! is_email( $_POST['login_username'] ) ) {
self::add_error( __( 'Invalid username', 'image-cdn' ), 'login' );
wp_redirect( admin_url( '/admin.php?page=image_cdn' ) );
exit;
}

if ( ! isset( $_POST['login_password'] ) ) {
self::add_error( __( 'Invalid password', 'image-cdn' ), 'login' );
wp_redirect( admin_url( '/admin.php?page=image_cdn' ) );
exit;
}

try {
Expand All @@ -478,10 +486,12 @@ public static function login() {
if ( is_string( $message ) ) {
self::add_success( $message );
wp_redirect( admin_url( '/admin.php?page=image_cdn' ) );
exit;
}
} catch ( \Exception $e ) {
self::add_error( __( 'An error occurred!', 'image-cdn' ), 'login' );
wp_redirect( admin_url( '/admin.php?page=image_cdn' ) );
exit;
}
}

Expand All @@ -493,16 +503,19 @@ public static function logout() {
if ( ! wp_verify_nonce( $nonce, 'image_cdn_logout_nonce' ) || ! current_user_can( 'administrator' ) ) {
self::add_error( __( 'Unauthorized', 'image-cdn' ) );
wp_redirect( admin_url( '/admin.php?page=image_cdn' ) );
exit;
}

try {
self::client()->logout();

self::add_success( __("Logged out!", 'image-cdn') );
wp_redirect( admin_url( '/admin.php?page=image_cdn' ) );
exit;
} catch ( \Exception $e ) {
self::add_error( __( 'An error occurred!', 'image-cdn' ) );
wp_redirect( admin_url( '/admin.php?page=image_cdn' ) );
exit;
}
}

Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: imageengine
Tags: image cdn, ImageEngine, avif, webp, jpegxl
Requires at least: 5.3
Tested up to: 6.5.5
Tested up to: 6.6.1
Requires PHP: 7.4
Stable tag: trunk
License: GPLv2 or later
Expand Down Expand Up @@ -91,6 +91,10 @@ The following are the steps to install the Image CDN plugin

== Changelog ==

= 1.2.3 =
* Fixed: Email validation issues
* Tested up to 6.6.1

= 1.2.2 =
* Fixed: Image Engine create subscription, added newer endpoint
* Tested up to 6.5.5
Expand Down

0 comments on commit 3c30044

Please sign in to comment.