Advertisement:

Author Topic: Mobile number login  (Read 1033 times)

Arun123

  • Newbie
  • *
  • Posts: 13
Mobile number login
« on: April 11, 2018, 09:47:51 pm »
How to create mobile number login or how to convert email login to mobile number login
Please any idea ??????

bobyrou

  • Newbie
  • *
  • Posts: 30
Re: Mobile number login
« Reply #1 on: April 14, 2018, 11:31:36 pm »
this is a good idea :) I'm interested too

Arun123

  • Newbie
  • *
  • Posts: 13
Re: Mobile number login
« Reply #2 on: April 30, 2018, 09:37:39 pm »
How to remove email validation ?

Digitalsense

  • Jr. Member
  • **
  • Posts: 78
  • Hello there! - digitalsense.in
Re: Mobile number login
« Reply #3 on: May 03, 2018, 03:30:16 pm »
How to create mobile number login or how to convert email login to mobile number login
Please any idea ??????

Use this plugin

https://market.osclass.org/plugins/messaging/sms-notification-world-wide-sms-support_936

It will send SMS to the user for validation along with email.

bobyrou

  • Newbie
  • *
  • Posts: 30
Re: Mobile number login
« Reply #4 on: May 08, 2018, 03:26:28 pm »
No, I will still prefer login by typing phone number instead of email address. No phone verification needed

Digitalsense

  • Jr. Member
  • **
  • Posts: 78
  • Hello there! - digitalsense.in
Re: Mobile number login
« Reply #5 on: June 09, 2018, 05:54:26 pm »
Hello guys,

I think finally a bit of solution I found.

first add a mobile number along with user email in user registration page user-register.php
email would be compulsory as it is default in script.

than in file oc-includes/osclass/UserActions.php

add this code after line 85

$mobile = Params::getParam('s_phone_mobile');
            if($mobile){
                 $username_taken = $this->manager->findByUsername($mobile);
                if( !$error && $username_taken != false ) {
                    $flash_error .= _m("Mobile is already Registered") . PHP_EOL;
                    $error[] = 8;
                }
            }

and update the below code as well

 
            if($input['s_username']=='') {
               
            if($mobile!=''){
                $this->manager->update(
                                 array('s_username' => $mobile)
                                ,array('pk_i_id'  => $userId)
                );
            }else{
               $this->manager->update(
                                 array('s_username' => $userId)
                                ,array('pk_i_id'  => $userId)
                );
           

I was able to register user and use mobile number as login.

Logic I m updating mobile number as username instead of userid so users will be able to login with mobile number or email id

I am attaching the file as well for you to compare.

« Last Edit: June 09, 2018, 09:14:43 pm by Digital Sense »

Arun123

  • Newbie
  • *
  • Posts: 13
Re: Mobile number login
« Reply #6 on: June 18, 2018, 01:45:29 pm »
Not working blank page

Digitalsense

  • Jr. Member
  • **
  • Posts: 78
  • Hello there! - digitalsense.in
Re: Mobile number login
« Reply #7 on: June 20, 2018, 01:17:28 pm »
Hi

I have implemented the same on https://onlineadbazar.com/ have a look

Arun123

  • Newbie
  • *
  • Posts: 13
Re: Mobile number login
« Reply #8 on: June 22, 2018, 08:58:07 pm »
@Ananaya

Fantastic! This really helps. Thank you

Arun123

  • Newbie
  • *
  • Posts: 13
Re: Mobile number login
« Reply #9 on: June 22, 2018, 11:06:44 pm »
@Ananaya
Hello brother

I mean user registration is only by using mobile number

if($mobile!=''){
            if($input['s_email']=='') {
               
            if($mobile!=''){
                $this->manager->update(
                                 array('s_email' => $mobile)
                                ,array('pk_i_id'  => $userId)
                );
            }else{
               $this->manager->update(
                                 array('s_username' => $userId)
                                ,array('pk_i_id'  => $userId)
                );
            }
}
}

is it possible to add @example.com ?
« Last Edit: June 22, 2018, 11:08:49 pm by Arun123 »

Digitalsense

  • Jr. Member
  • **
  • Posts: 78
  • Hello there! - digitalsense.in
Re: Mobile number login
« Reply #10 on: June 23, 2018, 09:03:13 am »
you can use like
 if($input['s_email']=='') {
$str1 =  $mobile;
$str2 = '@example.com';
$mobileemail = $str1 . $str2;
}
but in the above case you would need to disable all messages going to users as the emails don't exist and it may create a-lot of email sending errors.

I hope it helps :)

Arun123

  • Newbie
  • *
  • Posts: 13
Re: Mobile number login
« Reply #11 on: June 23, 2018, 02:32:40 pm »
registration success but error message

oc-includes/osclass/controller/login.php

Arun123

  • Newbie
  • *
  • Posts: 13
Re: Mobile number login
« Reply #12 on: June 23, 2018, 02:38:21 pm »
@TechNerd

sms notification plugin is yours ?

Digitalsense

  • Jr. Member
  • **
  • Posts: 78
  • Hello there! - digitalsense.in
Re: Mobile number login
« Reply #13 on: June 25, 2018, 09:02:21 am »
@TechNerd

sms notification plugin is yours ?

Yes its mine

ala

  • Full Member
  • ***
  • Posts: 204
Re: Mobile number login
« Reply #14 on: June 26, 2018, 04:23:56 pm »
@TechNerd
Quote
I think finally a bit of solution I found.

first add a mobile number along with user email in user registration page user-register.php
email would be compulsory as it is default in script.

than in file oc-includes/osclass/UserActions.php

add this code after line 85

$mobile = Params::getParam('s_phone_mobile');
            if($mobile){
                 $username_taken = $this->manager->findByUsername($mobile);
                if( !$error && $username_taken != false ) {
                    $flash_error .= _m("Mobile is already Registered") . PHP_EOL;
                    $error[] = 8;
                }
            }

and update the below code as well

 
            if($input['s_username']=='') {
               
            if($mobile!=''){
                $this->manager->update(
                                 array('s_username' => $mobile)
                                ,array('pk_i_id'  => $userId)
                );
            }else{
               $this->manager->update(
                                 array('s_username' => $userId)
                                ,array('pk_i_id'  => $userId)
                );
           

when you login with social login  it will have problem