Skip to content

Commit

Permalink
v2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
milesimarco committed Oct 25, 2023
1 parent 8392eb5 commit 7bbf06e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
16 changes: 9 additions & 7 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Tags: spid, italia, sistema, pubblico, identità, digitale, login, sistema pubbl
Requires at least: 4.8
Requires PHP: 7
Tested up to: 6.4
Version: 2.7.2
Stable tag: 2.7.2
Version: 2.8
Stable tag: 2.8
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand All @@ -23,7 +23,7 @@ https://www.youtube.com/watch?v=w5Z5EBG1R1M

https://www.youtube.com/watch?v=i2eTL_Q2xfM

Copyright © 2017-2023 **Marco Milesi**
Copyright © 2017-2024 **Marco Milesi**
[www.marcomilesi.com](https://www.marcomilesi.com) - [www.wpgov.it](https://www.wpgov.it)

### Ringraziamenti
Expand All @@ -49,10 +49,12 @@ https://www.youtube.com/watch?v=2UNAtVjFFAs
== Changelog ==
> Backup your data before upgrade.

= 2.7.2 20231025 =
* [BUGFIX] Error with missing reset password button with some configurations
* [BUGFIX] Better login error handling and prevent errors with some configurations
* Tested with WP 6.4
= 2.8 20231025 =
* [IMPROVE] Nuova gestione degli errori in caso di utenza non registrata (messaggio su standard WP)
* [IMPROVE] Revisione filtro in caso di nuove utenze con controllo classe WP_User (rif. wp-spid-italia.php:284)
* [BUGFIX] Corretto errore di mancata possibilità reset password WP in alcune configurazioni
* [BUGFIX] Migliorata la gestione degli errori in fase di login e errori in alcune configurazioni
* Testato con WordPress 6.4

= 2.7.1 20231004 =
* [BUGFIX] Error with missing reset password button with some configurations (thanks to effekt.it)
Expand Down
24 changes: 9 additions & 15 deletions wp-spid-italia.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: WP SPID Italia
Description: SPID - Sistema Pubblico di Identità Digitale
Author: Marco Milesi
Version: 2.7.2
Version: 2.8
Author URI: http://www.marcomilesi.com
*/

Expand Down Expand Up @@ -265,8 +265,8 @@ function spid_handle() {
$name = $attributes['email'][0];
$user = get_user_by( 'email', $attributes['email'] );
$cf = str_replace( 'TINIT-', '', $attributes['fiscalNumber']);
if ( empty( $user ) ) {

if ( empty( $user ) ) { // If user do not exists, look up by fiscal code
$users = get_users(
array(
'meta_key' => 'codice_fiscale',
Expand All @@ -281,8 +281,8 @@ function spid_handle() {
$user = apply_filters( 'spid_registration_filter_new_user', $attributes );
}
}
if ( !is_wp_error( $user ) && !empty( $user ) ) {
if ( is_a( $user, 'WP_User' ) && !is_wp_error( $user ) && !empty( $user ) ) {

apply_filters( 'spid_registration_filter_existing_user', $attributes, $user );

spid_update_user( $user, $attributes );
Expand All @@ -296,16 +296,10 @@ function spid_handle() {
exit();

} else {

echo '<img src="'.plugin_dir_url( __FILE__ ). '/img/spid.jpg" width="100%" />';
echo '<style>body { background-color: #0066cb; }</style>';
echo '<p style="color:#fff;font-size:1.2em;text-align:center;">';
$attributes = $sp->getAttributes();
echo 'Gentile '.$attributes['name'].',<br>il tuo account non è abilitato su questo sito.';

echo '<br><br><a class="button button-secondary button-large" href="'.esc_url( wp_spid_italia_get_login_url( 'out' ) .'?spid_sso=out' ).'" alt="Logout">Disconnetti SPID</a>';
echo '</p>';
die();
remove_action('login_footer', 'wp_shake_js', 12);
add_filter( 'login_errors', function() {
return 'Il tuo account non è abilitato su questo sito.';
} );
}
} else {
remove_action('login_footer', 'wp_shake_js', 12);
Expand Down

0 comments on commit 7bbf06e

Please sign in to comment.