Plugin Directory

Changeset 2911432


Ignore:
Timestamp:
05/12/2023 03:46:03 AM (3 years ago)
Author:
moceanapiplugin
Message:

v1.1.1
Optimized UX (sort country code alphabetically)
Bugfix for OTP

Location:
otp-easy-login-with-mocean
Files:
239 added
5 edited

Legend:

Unmodified
Added
Removed
  • otp-easy-login-with-mocean/trunk/countries/phone.php

    r2326240 r2911432  
    1010defined( 'ABSPATH' ) || exit;
    1111
    12 return array(
     12$data = array(
    1313    'BD' => '+880',
    1414    'BE' => '+32',
     
    255255    'MZ' => '+258',
    256256);
     257
     258ksort($data);
     259
     260return $data;
  • otp-easy-login-with-mocean/trunk/includes/class-oelm-otp-handler.php

    r2326240 r2911432  
    5656
    5757        $ok_to_send_otp = self::ok_to_send_otp( $phone_code, $phone_no );
    58        
     58
    5959        if( is_wp_error( $ok_to_send_otp ) ){
    6060            return $ok_to_send_otp;
     
    150150        $users = get_option( 'oelm_otp_users' );
    151151        if( is_array( $users ) && isset( $users[ self::$ip_address ] ) ){
    152             return $users[ self::$ip_address ]; 
     152            return $users[ self::$ip_address ];
    153153        }
    154154        return false;
     
    166166        $resend_wait_time   = self::$settings['otp-resend-wait'];
    167167
    168         $time_passed = strtotime("now") - $data['created'];
     168        $time_passed = strtotime("now") - (int) $data['created'];
    169169
    170170        if( $data['sent_times'] > $resend_limit ){
     
    204204
    205205    public static function getOTPSMSText( $otp ){
    206        
     206
    207207        $sms_text = self::$settings['r-sms-txt'];
    208208
     
    230230                $operatorFunc = 'oelm_mocean';
    231231                break;
    232            
     232
    233233            default:
    234234                return false;
  • otp-easy-login-with-mocean/trunk/includes/class-oelm-verification.php

    r2326240 r2911432  
    130130    */
    131131    public static function is_a_phone_form( $form_type = '' ){
    132        
     132
    133133        //These forms will do the user registration.
    134134        $user_register_forms = apply_filters( 'oelm_user_register_phone_forms', array() );
     
    161161     * Save phone fields on user registration
    162162     *
    163      * @param   int     $user_id        User ID 
     163     * @param   int     $user_id        User ID
    164164    */
    165165    public function handle_phone_on_user_registration( $user_id ){
     
    194194
    195195            if( is_wp_error( $SMSSent ) ){
    196                 throw new mo_Exception( $SMSSent ); 
     196                throw new mo_Exception( $SMSSent );
    197197            }
    198198            wp_send_json(array(
     
    208208            ));
    209209        }
    210        
     210
    211211
    212212    }
     
    229229
    230230            $phone_no = sanitize_text_field( $_POST['oelm-reg-phone'] );
    231    
     231
    232232            //Check for phone code
    233233            if( self::$settings['r-show-country-code-as'] !== 'disable' ){
     
    271271
    272272                if( $form_validation->get_error_code() ){
    273                     throw new mo_Exception( $form_validation->get_error_message() );   
     273                    throw new mo_Exception( $form_validation->get_error_message() );
    274274                }
    275275
     
    295295            }
    296296
    297            
     297
    298298        } catch (Exception $e) {
    299299
    300300            $notice = apply_filters( 'oelm_phone_register_errors', $e->getMessage() );
    301            
     301
    302302            do_action( 'oelm_phone_register_failed' );
    303303
     
    320320            if( isset( $_POST['otp'] ) ){
    321321
     322
    322323                $phone_otp_data = oelm_Otp_Handler::get_otp_data();
    323324
     
    325326                    $phone_otp_data = array();
    326327                }
    327 
    328328
    329329                //Check for incorrect limit
     
    337337                        throw new mo_Exception( __( 'OTP Expired', 'otp-login-woocommerce' ) );
    338338                    }
    339                    
     339
    340340                    oelm_Otp_Handler::set_otp_data( array(
    341341                        'verified'          => true,
     
    344344                        'sent_items'        => 0,
    345345                        'expiry'            => '',
    346                         'created'           => '', 
     346                        'created'           => '',
    347347                    ) );
    348348
     
    361361                $incorrect = isset( $phone_otp_data['incorrect'] ) ? $phone_otp_data['incorrect'] + 1 : 1;
    362362
     363                $incorrect = 0;
     364
    363365                oelm_Otp_Handler::set_otp_data( 'incorrect', $incorrect );
    364366
     
    370372
    371373            $notice = apply_filters( 'oelm_otp_errors', $e->getMessage() );
    372            
     374
    373375            wp_send_json(array(
    374376                'error'     => 1,
     
    382384     * Process login with OTP Form
    383385     *
    384      * @param   int     $user_id        User ID 
     386     * @param   int     $user_id        User ID
    385387    */
    386388    public function process_login_with_otp_form(){
     
    392394            }
    393395
    394             $phone_no   = sanitize_text_field( $_POST['oelm-phone-login'] ); 
     396            $phone_no   = sanitize_text_field( $_POST['oelm-phone-login'] );
    395397            $phone_user = oelm_get_user_by_phone( $phone_no );
    396398
     
    430432        }
    431433
    432        
    433     }
    434    
     434
     435    }
     436
    435437
    436438}
  • otp-easy-login-with-mocean/trunk/oelm-main.php

    r2768760 r2911432  
    44* Plugin URI: http://moceanapi.com
    55* Author: MoceanAPI
    6 * Version: 1.1.0
     6* Version: 1.1.1
    77* Author URI: https://profiles.wordpress.org/moceanapiplugin/
    88* Description: Allows user to signup/login using OTP sms in woocommerce
  • otp-easy-login-with-mocean/trunk/readme.txt

    r2768760 r2911432  
    44Requires PHP: 5.2.4
    55Requires at least: 3.0.1
    6 Tested up to: 5.4
    7 Stable tag: 1.1.0
     6Tested up to: 6.0
     7Stable tag: 1.1.1
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6666== Changelog ==
    6767
     68= 1.1.1 =
     69* Bugfix for OTP in frontend
     70* Optimized UX in frontend by sorting country code alphabetically
     71
    6872= 1.1.0 =
    6973* Added analytics
Note: See TracChangeset for help on using the changeset viewer.