Changeset 3106088
- Timestamp:
- 06/22/2024 08:00:25 PM (6 weeks ago)
- Location:
- mobile-bankid-integration/trunk
- Files:
-
- 3 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
mobile-bankid-integration/trunk/includes/admin/class-admin.php
r3084002 r3106088 33 33 self::add_tab( __( 'Integrations', 'mobile-bankid-integration' ), 'integrations', array( $this, 'page_integrations' ) ); 34 34 self::add_tab( __( 'Contribute', 'mobile-bankid-integration' ), 'contribute', array( $this, 'page_contribute' ) ); 35 36 37 38 39 40 41 42 35 43 } 36 44 … … 421 429 color: rgb(201, 97, 152); 422 430 } 423 431 </style> 424 432 <?php 425 433 } 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 426 480 } -
mobile-bankid-integration/trunk/includes/class-activation.php
r3084002 r3106088 65 65 */ 66 66 private function checkrequirements() { 67 // Check if running on Windows.68 if ( strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN' ) {69 wp_die( esc_html__( 'Due to bugs and limitations in the plugins dependencies, this plugin does not work on Windows. Please try again on a Linux server.', 'mobile-bankid-integration' ) );70 }71 67 // Check if PHP version is 7.4 or higher. 72 68 if ( version_compare( PHP_VERSION, '7.4.0' ) < 0 ) { -
mobile-bankid-integration/trunk/includes/class-core.php
r3084002 r3106088 48 48 if ( get_option( 'mobile_bankid_integration_env' ) && get_option( 'mobile_bankid_integration_certificate' ) && get_option( 'mobile_bankid_integration_password' ) ) { 49 49 $this->create_bankid_service(); 50 51 52 53 54 55 50 56 do_action( 'mobile_bankid_integration_init' ); 51 57 } … … 161 167 162 168 /** 163 * Get user ID from personal number.164 * 165 * @param string $personal_number Personal number (12 digits, no hyphen).169 * Get user ID from personal number. 170 * 171 * @param string $personal_number Personal number (12 digits, no hyphen). 166 172 * @return int|false 167 173 */ 168 174 public function getUserIdFromPersonalNumber( $personal_number ) { 169 // Get user by personal number from User Meta.175 // Get user by personal number from User Meta. 170 176 $user_query = new \WP_User_Query( 171 177 array( … … 182 188 183 189 /** 184 * Set personal number for user.190 * Set personal number for user. 185 191 * 186 192 * @param int $user_id User ID. 187 * @param string $personal_number Personal number (12 digits, no hyphen).193 * @param string $personal_number Personal number (12 digits, no hyphen). 188 194 * @return void 189 195 */ 190 196 public function setPersonalNumberForUser( $user_id, $personal_number ) { 191 // Check if user already has a personal number.197 // Check if user already has a personal number. 192 198 if ( $this->getUserIdFromPersonalNumber( $personal_number ) !== false ) { 193 199 return; -
mobile-bankid-integration/trunk/includes/class-session.php
r3084002 r3106088 25 25 26 26 /** 27 * The personal number.�� 27 * The personal number. 28 28 * 29 29 * @var string … … 49 49 * 50 50 * @param int $user_id The user ID. 51 * @param string|null $personal_number The personal number.51 * @param string|null $personal_number The personal number. 52 52 * @param int|null $time_created The time the session was created. 53 53 * @return void|\WP_Error … … 67 67 } 68 68 if ( ! $personal_number ) { 69 $this->error = new \WP_Error( 'no_personal_number', __( 'No personal number found.', 'mobile-bankid-integration' ) );69 $this->error = new \WP_Error( 'no_personal_number', __( 'No personal number found.', 'mobile-bankid-integration' ) ); 70 70 } 71 71 $this->user_id = $user_id; -
mobile-bankid-integration/trunk/includes/integrations/woocommerce.php
r3070283 r3106088 98 98 */ 99 99 public function __construct() { 100 if ( get_option( 'mobile_bankid_integration_woocommerce_login' ) === 'yes' && ( get_option( 'mobile_bankid_integration_certificate' ) && get_option( 'mobile_bankid_integration_password' ) && get_option( 'mobile_bankid_integration_en dpoint' ) ) ) {100 if ( get_option( 'mobile_bankid_integration_woocommerce_login' ) === 'yes' && ( get_option( 'mobile_bankid_integration_certificate' ) && get_option( 'mobile_bankid_integration_password' ) && get_option( 'mobile_bankid_integration_en' ) ) ) { 101 101 add_action( 102 102 'woocommerce_login_form_end', … … 119 119 */ 120 120 public function __construct() { 121 122 123 124 121 125 if ( get_option( 'mobile_bankid_integration_woocommerce_checkout_require_bankid' ) !== 'yes' ) { 122 126 return; … … 173 177 public function age_check(): bool { 174 178 $age = get_option( 'mobile_bankid_integration_woocommerce_age_check', 0 ); 179 180 181 182 183 184 185 186 187 175 188 if ( $age <= 0 ) { 176 189 return true; -
mobile-bankid-integration/trunk/includes/settings/class-usersettings.php
r3070283 r3106088 23 23 24 24 /** 25 * Show personal number field.25 * Show personal number field. 26 26 * 27 27 * @param object $user User object. … … 33 33 <table class="form-table"> 34 34 <tr> 35 <th><label for="personal_number"><?php esc_html_e( 'Personal number (12 digits, no hyphen)', 'mobile-bankid-integration' ); ?></label></th>35 <th><label for="personal_number"><?php esc_html_e( 'Personal number (12 digits, no hyphen)', 'mobile-bankid-integration' ); ?></label></th> 36 36 <td> 37 37 <input type="text" name="personal_number" id="personal_number" … … 40 40 echo 'disabled'; } 41 41 ?> 42 value="<?php echo esc_attr( get_user_meta( $user->ID, 'mobile_bankid_integration_personal_number', true ) ); ?>" placeholder="<?php /* translators: Placeholder personal number. */ esc_attr_e( 'YYYYMMDDXXXX', 'mobile-bankid-integration' ); ?>" class="regular-text" />42 value="<?php echo esc_attr( get_user_meta( $user->ID, 'mobile_bankid_integration_personal_number', true ) ); ?>" placeholder="<?php /* translators: Placeholder personal number. */ esc_attr_e( 'YYYYMMDDXXXX', 'mobile-bankid-integration' ); ?>" class="regular-text" /> 43 43 </td> 44 44 </tr> … … 48 48 49 49 /** 50 * Save personal number field.50 * Save personal number field. 51 51 * 52 52 * @param int $user_id User ID. … … 58 58 59 59 if ( current_user_can( 'edit_users' ) ) { 60 // Check if personal number is valid and save it if it is.60 // Check if personal number is valid and save it if it is. 61 61 if ( preg_match( '/^[0-9]{12}$/', $personal_number ) && Personnummer::valid( $personal_number ) ) { 62 // Check if user with this personal number already exists.62 // Check if user with this personal number already exists. 63 63 $check = get_users( 64 64 array( … … 76 76 update_user_meta( $user_id, 'mobile_bankid_integration_personal_number', $personal_number ); 77 77 } elseif ( strlen( $personal_number ) === 0 ) { 78 delete_user_meta( $user_id, ' personal_number' );78 delete_user_meta( $user_id, 'personal_number' ); 79 79 } else { 80 80 add_action( 'user_profile_update_errors', array( $this, 'personal_number_update_error_invalid' ), 10, 3 ); … … 85 85 86 86 /** 87 * Add error message if personal number already exists.87 * Add error message if personal number already exists. 88 88 * 89 89 * @param object $errors WP_Error object. … … 93 93 */ 94 94 public function personal_number_update_error_already_exists( $errors, $update, $user ) { 95 $errors->add( 'personal_number', esc_html__( 'User with this personal number already exists.', 'mobile-bankid-integration' ) );95 $errors->add( 'personal_number', esc_html__( 'User with this personal number already exists.', 'mobile-bankid-integration' ) ); 96 96 } 97 97 98 98 /** 99 * Add error message if personal number is invalid.99 * Add error message if personal number is invalid. 100 100 * 101 101 * @param object $errors WP_Error object. … … 105 105 */ 106 106 public function personal_number_update_error_invalid( $errors, $update, $user ) { 107 $errors->add( 'personal_number', esc_html__( 'Personal number is not valid.', 'mobile-bankid-integration' ) );107 $errors->add( 'personal_number', esc_html__( 'Personal number is not valid.', 'mobile-bankid-integration' ) ); 108 108 } 109 109 } -
mobile-bankid-integration/trunk/includes/settings/views/setup-finish.php
r3070283 r3106088 4 4 5 5 <h1><?php esc_html_e( 'Setup is complete', 'mobile-bankid-integration' ); ?></h1> 6 <p><?php esc_html_e( 'Mobile BankID Integration is now setup and ready to use. You can now login to your WordPress site using BankID as soon as you have added your personal number to your account.', 'mobile-bankid-integration' ); ?></p>6 <p><?php esc_html_e( 'Mobile BankID Integration is now setup and ready to use. You can now login to your WordPress site using BankID as soon as you have added your personal number to your account.', 'mobile-bankid-integration' ); ?></p> 7 7 8 8 <a href="<?php echo esc_url( admin_url( 'admin.php?page=mobile-bankid-integration' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Go to settings', 'mobile-bankid-integration' ); ?></a> -
mobile-bankid-integration/trunk/includes/wp-login/class-api.php
r3084002 r3106088 128 128 * Sign in user from BankID or create user if it does not exist and registration is enabled. 129 129 * 130 * @param string $personal_number Personal number of user.130 * @param string $personal_number Personal number of user. 131 131 * @param string $fname First name as returned from BankID API. 132 132 * @param string $lname Last name as returned from BankID API. … … 134 134 */ 135 135 private function sign_in_as_user_from_bankid( $personal_number, $fname, $lname ) { 136 // Get user by personal number from DB.136 // Get user by personal number from DB. 137 137 $user_id = Core::$instance->getUserIdFromPersonalNumber( $personal_number ); 138 138 … … 156 156 ); 157 157 158 // Set user personal number.158 // Set user personal number. 159 159 Core::$instance->setPersonalNumberForUser( $user_id, $personal_number ); 160 160 } else { … … 166 166 Core::$instance->createAuthCookie( $user_id ); 167 167 do_action( 'wp_login', $personal_number, $user ); 168 169 170 171 172 173 174 175 168 176 return $user; 169 177 } … … 180 188 $user_exists = username_exists( 'user_' . $rnd_str ); 181 189 } while ( $user_exists > 0 ); 182 return 'user_' . $rnd_str; 190 191 $username = 'user_' . $rnd_str; 192 193 /** 194 * Filter the username generated for new users. 195 * 196 * @param string $username Username. 197 * @since 1.3 198 */ 199 $username = apply_filters( 'mobile_bankid_integration_new_user_username', $username ); 200 201 return $username; 183 202 } 184 203 } -
mobile-bankid-integration/trunk/includes/wp-login/class-login.php
r3084002 r3106088 15 15 */ 16 16 public function __construct() { 17 if ( get_option( 'mobile_bankid_integration_wplogin' ) === 'as_alternative' && ( get_option( 'mobile_bankid_integration_certificate' ) && get_option( 'mobile_bankid_integration_password' ) && get_option( 'mobile_bankid_integration_en dpoint' ) ) ) {17 if ( get_option( 'mobile_bankid_integration_wplogin' ) === 'as_alternative' && ( get_option( 'mobile_bankid_integration_certificate' ) && get_option( 'mobile_bankid_integration_password' ) && get_option( 'mobile_bankid_integration_en' ) ) ) { 18 18 add_action( 'login_form', array( $this, 'login_button' ), 40 ); 19 19 add_action( -
mobile-bankid-integration/trunk/mobile-bankid-integration.php
r3084002 r3106088 3 3 Plugin Name: Mobile BankID Integration 4 4 Description: A plugin that allows you to integrate Mobile BankID with your WordPress site. 5 Version: 1. 25 Version: 1. 6 6 Author: Jamie Blomerus 7 7 Author URI: https://github.com/jamieblomerus … … 14 14 15 15 // Define constants. 16 define( 'MOBILE_BANKID_INTEGRATION_VERSION', '1. 2' );16 define( 'MOBILE_BANKID_INTEGRATION_VERSION', '1.' ); 17 17 define( 'MOBILE_BANKID_INTEGRATION_PLUGIN_FILE', __FILE__ ); 18 18 define( 'MOBILE_BANKID_INTEGRATION_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); … … 59 59 require_once MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'includes/admin/class-admin.php'; 60 60 require_once MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'includes/integrations/load.php'; 61 62 61 63 } 62 64 -
mobile-bankid-integration/trunk/readme.txt
r3089062 r3106088 4 4 Requires at least: 5.2 5 5 Tested up to: 6.5 6 Stable tag: 1. 26 Stable tag: 1. 7 7 Requires PHP: 7.2 8 8 License: GPLv3 or later … … 33 33 = Can I help translate it to my language? = 34 34 35 Contribute to the translation of this plugin at Translating WordPress.35 Contribute to the translation of this plugin at . 36 36 37 37 = I do miss one feature = … … 40 40 41 41 = How do I buy the BankID service? = 42 To buy the BankID service and receive a FP certificate, you need to contact your bank. For more information, please visit this [guide](https://www.bankid.com/en/foretag/anslut-foeretag).42 To buy the BankID service and receive a P certificate, you need to contact your bank. For more information, please visit this [guide](https://www.bankid.com/en/foretag/anslut-foeretag). 43 43 44 = I want to test the plugin, but I don't have a Mobile BankID or FP certificate =44 = I want to test the plugin, but I don't have a Mobile BankID or P certificate = 45 45 46 46 If you are only testing the service out, you can during the setup choose to run the plugin against the testing environment and use a [test BankID](https://www.bankid.com/en/utvecklare/test/skaffa-testbankid/test-bankid-get). 47 47 48 48 == Changelog == 49 50 51 52 53 54 55 56 57 49 58 50 59 = 1.2 = … … 75 84 == Upgrade Notice == 76 85 86 87 88 77 89 = 1.2 = 78 90 Major update. Requires total reinstallation of the plugin. -
mobile-bankid-integration/trunk/vendor/autoload.php
r3084002 r3106088 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit 841ba1d7db30a331995bbf9dcd7573e3::getLoader();25 return ComposerAutoloaderInit::getLoader(); -
mobile-bankid-integration/trunk/vendor/composer/autoload_psr4.php
r3084002 r3106088 9 9 'chillerlan\\Settings\\' => array($vendorDir . '/chillerlan/php-settings-container/src'), 10 10 'chillerlan\\QRCode\\' => array($vendorDir . '/chillerlan/php-qrcode/src'), 11 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http- factory/src', $vendorDir . '/psr/http-message/src'),11 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-/src'), 12 12 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'), 13 13 'Personnummer\\' => array($vendorDir . '/personnummer/personnummer/src'), -
mobile-bankid-integration/trunk/vendor/composer/autoload_real.php
r3084002 r3106088 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 841ba1d7db30a331995bbf9dcd7573e35 class ComposerAutoloaderInit 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 841ba1d7db30a331995bbf9dcd7573e3', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 841ba1d7db30a331995bbf9dcd7573e3', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 841ba1d7db30a331995bbf9dcd7573e3::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit::getInitializer($loader)); 33 33 34 34 $loader->register(true); 35 35 36 $filesToLoad = \Composer\Autoload\ComposerStaticInit 841ba1d7db30a331995bbf9dcd7573e3::$files;36 $filesToLoad = \Composer\Autoload\ComposerStaticInit::$files; 37 37 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 38 38 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
mobile-bankid-integration/trunk/vendor/composer/autoload_static.php
r3084002 r3106088 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 841ba1d7db30a331995bbf9dcd7573e37 class ComposerStaticInit 8 8 { 9 9 public static $files = array ( … … 48 48 'Psr\\Http\\Message\\' => 49 49 array ( 50 0 => __DIR__ . '/..' . '/psr/http- factory/src',51 1 => __DIR__ . '/..' . '/psr/http- message/src',50 0 => __DIR__ . '/..' . '/psr/http-/src', 51 1 => __DIR__ . '/..' . '/psr/http-/src', 52 52 ), 53 53 'Psr\\Http\\Client\\' => … … 217 217 { 218 218 return \Closure::bind(function () use ($loader) { 219 $loader->prefixLengthsPsr4 = ComposerStaticInit 841ba1d7db30a331995bbf9dcd7573e3::$prefixLengthsPsr4;220 $loader->prefixDirsPsr4 = ComposerStaticInit 841ba1d7db30a331995bbf9dcd7573e3::$prefixDirsPsr4;221 $loader->classMap = ComposerStaticInit 841ba1d7db30a331995bbf9dcd7573e3::$classMap;219 $loader->prefixLengthsPsr4 = ComposerStaticInit::$prefixLengthsPsr4; 220 $loader->prefixDirsPsr4 = ComposerStaticInit::$prefixDirsPsr4; 221 $loader->classMap = ComposerStaticInit::$classMap; 222 222 223 223 }, null, ClassLoader::class); -
mobile-bankid-integration/trunk/vendor/composer/installed.json
r3084002 r3106088 662 662 { 663 663 "name": "psr/http-factory", 664 "version": "1. 0.2",665 "version_normalized": "1. 0.2.0",664 "version": "1.", 665 "version_normalized": "1..0", 666 666 "source": { 667 667 "type": "git", 668 668 "url": "https://github.com/php-fig/http-factory.git", 669 "reference": " e616d01114759c4c489f93b099585439f795fe35"670 }, 671 "dist": { 672 "type": "zip", 673 "url": "https://api.github.com/repos/php-fig/http-factory/zipball/ e616d01114759c4c489f93b099585439f795fe35",674 "reference": " e616d01114759c4c489f93b099585439f795fe35",675 "shasum": "" 676 }, 677 "require": { 678 "php": ">=7. 0.0",669 "reference": "" 670 }, 671 "dist": { 672 "type": "zip", 673 "url": "https://api.github.com/repos/php-fig/http-factory/zipball/", 674 "reference": "", 675 "shasum": "" 676 }, 677 "require": { 678 "php": ">=7.", 679 679 "psr/http-message": "^1.0 || ^2.0" 680 680 }, 681 "time": "202 3-04-10T20:10:41+00:00",681 "time": "202+00:00", 682 682 "type": "library", 683 683 "extra": { … … 702 702 } 703 703 ], 704 "description": " Common interfaces for PSR-7 HTTP message factories",704 "description": "Common interfaces for PSR-7 HTTP message factories", 705 705 "keywords": [ 706 706 "factory", … … 714 714 ], 715 715 "support": { 716 "source": "https://github.com/php-fig/http-factory /tree/1.0.2"716 "source": "https://github.com/php-fig/http-factory" 717 717 }, 718 718 "install-path": "../psr/http-factory" -
mobile-bankid-integration/trunk/vendor/composer/installed.php
r3084002 r3106088 4 4 'pretty_version' => 'dev-trunk', 5 5 'version' => 'dev-trunk', 6 'reference' => ' 7aedfae704fa281f38077e40019261b06e1964e7',6 'reference' => '', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-trunk', 15 15 'version' => 'dev-trunk', 16 'reference' => ' 7aedfae704fa281f38077e40019261b06e1964e7',16 'reference' => '', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', … … 99 99 ), 100 100 'psr/http-factory' => array( 101 'pretty_version' => '1. 0.2',102 'version' => '1. 0.2.0',103 'reference' => ' e616d01114759c4c489f93b099585439f795fe35',101 'pretty_version' => '1.', 102 'version' => '1..0', 103 'reference' => '', 104 104 'type' => 'library', 105 105 'install_path' => __DIR__ . '/../psr/http-factory', -
mobile-bankid-integration/trunk/vendor/psr/http-factory/composer.json
r3070283 r3106088 1 1 { 2 2 "name": "psr/http-factory", 3 "description": " Common interfaces for PSR-7 HTTP message factories",3 "description": "Common interfaces for PSR-7 HTTP message factories", 4 4 "keywords": [ 5 5 "psr", … … 19 19 } 20 20 ], 21 22 23 21 24 "require": { 22 "php": ">=7. 0.0",25 "php": ">=7.", 23 26 "psr/http-message": "^1.0 || ^2.0" 24 27 }, -
mobile-bankid-integration/trunk/vendor/psr/http-factory/src/UploadedFileFactoryInterface.php
r3070283 r3106088 16 16 * @param StreamInterface $stream Underlying stream representing the 17 17 * uploaded file content. 18 * @param int $size in bytes18 * @param int $size in bytes 19 19 * @param int $error PHP file upload error 20 * @param string $clientFilename Filename as provided by the client, if any.21 * @param string $clientMediaType Media type as provided by the client, if any.20 * @param string $clientFilename Filename as provided by the client, if any. 21 * @param string $clientMediaType Media type as provided by the client, if any. 22 22 * 23 23 * @return UploadedFileInterface … … 27 27 public function createUploadedFile( 28 28 StreamInterface $stream, 29 int $size = null,29 int $size = null, 30 30 int $error = \UPLOAD_ERR_OK, 31 string $clientFilename = null,32 string $clientMediaType = null31 string $clientFilename = null, 32 string $clientMediaType = null 33 33 ): UploadedFileInterface; 34 34 }
Note: See TracChangeset
for help on using the changeset viewer.