Popup login with Email integration

Go down

Solved Popup login with Email integration

Post by Simone Boi February 5th 2021, 10:08 am

Hi! First of all thanks for your help guys, I followed a lot of tutorials from this forum.
Now, my question is:

How can I add a popup login (like in this forum) but that works with email aswell?

Let me explain myself, in my forum I have the chance to login with username + password, or email + password, and it works good, but if I add the popup login, the email + password won't work. How can use both?

Thank for help!
avatar
Simone Boi
Forumember

Posts : 65
Reputation : 1
Language : Italian

View user profile https://gamespledge.forumattivo.com/

Back to top Go down

Solved Re: Popup login with Email integration

Post by Ape February 5th 2021, 3:49 pm

Sadly the popup system was only made to use the username and password but maybe @TheCrow @pedxz or maybe the one that made the code in the first place @Ange Tuteur could help on this one.


Popup login with Email integration Left1212Popup login with Email integration Center11Popup login with Email integration Right112
Popup login with Email integration Ape_b110
Popup login with Email integration Keep_s10
Popup login with Email integration Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 16529
Reputation : 1774
Language : fluent in dork / mumbojumbo & English haha

View user profile http://chatworld.forumotion.co.uk/

TonnyKamper, pedxz and Simone Boi like this post

Back to top Go down

Solved Re: Popup login with Email integration

Post by Simone Boi February 5th 2021, 3:55 pm

Uh ok, I hope they can help me! Thank you, I'll wait
avatar
Simone Boi
Forumember

Posts : 65
Reputation : 1
Language : Italian

View user profile https://gamespledge.forumattivo.com/

Ape likes this post

Back to top Go down

Solved Re: Popup login with Email integration

Post by pedxz February 6th 2021, 11:35 am

Hello @Simone Boi,

I suppose that you can use the code of this portuguese tutorial: "Sign in by email" by @Kyo Panda. You just need to allow guest to see the member list and create a new JavaScript page in all pages and use:
Code:
/*globals jQuery, _userdata*/
 
/**
 * Allow users to log in with their e-mail in place of username.
 *
 * @author Kyo Panda
 * @see <a href="http://ajuda.forumeiros.com">Fórum dos Fóruns</a>
 * @license MIT
 */
 
(function($) {
  'use strict';
 
  var config = {
      i18n: {
        pt: {
            loading: 'Carregando...',
        },
        en: {
            loading: 'Loading...',
        },
        es: {
            loading: 'Cargando...',
        }
      }
  };
 
  $(function() {
      var lang = window._userdata && config.i18n[_userdata.user_lang] ?
        config.i18n[_userdata.user_lang] : config.i18n.en
      ;
   
      var submitted = false;
   
      $('form[name="form_login"]').on('submit', function(event) {
        var $this = $(this);
     
        var $username = $this.find('input[name="username"]');
     
        if ($username.val().indexOf('@') === -1 || submitted) {
            $this.append('<input type="hidden" value="1" name="login" />');
            return true;
        }
     
        $this
            .find('input[type="submit"]')
            .val(lang.loading)
            .prop('disabled', true)
            .css('opacity', 0.5)
        ;
     
        $.get('/memberlist', {
            change_version: 'modernbb',
            mode: 'username',
            order: 'DESC',
            submit: true,
            username: $username.val()
        }, function(context) {
            var $name = $('.avatar-mini:first', context);
         
            if ($name.length) {
              $username.val($name.text().trim());
            }         
         
            submitted = true;
            $this.submit();
        });
     
        event.preventDefault();
      });
  });
}(jQuery));

The pop-up/modal you can use any one:
pedxz
pedxz
Forumember

Posts : 464
Reputation : 121
Language : 🇵🇹

View user profile https://www.forumotion.com/create-forum/modernbb

TonnyKamper and Simone Boi like this post

Back to top Go down

Solved Re: Popup login with Email integration

Post by Simone Boi February 6th 2021, 12:00 pm

Hi! Thanks for help, but still doesn't work, when I use the popup login it works (the popup), but if I try to login using email+password, it gives me error, wrong user or pw, while if I try the same without the popup login it works.
avatar
Simone Boi
Forumember

Posts : 65
Reputation : 1
Language : Italian

View user profile https://gamespledge.forumattivo.com/

Back to top Go down

Solved Re: Popup login with Email integration

Post by pedxz February 6th 2021, 12:53 pm

Change the code above to:
Code:
/*globals jQuery, _userdata*/
 
/**
 * Allow users to log in with their e-mail in place of username.
 *
 * @author Kyo Panda
 * @see <a href="http://ajuda.forumeiros.com">Fórum dos Fóruns</a>
 * @license MIT
 */
 
(function($) {
  'use strict';
 
  var config = {
      i18n: {
        pt: {
            loading: 'Carregando...',
        },
        en: {
            loading: 'Loading...',
        },
        es: {
            loading: 'Cargando...',
        }
      }
  };
 
  $(window).on('load', function() { 
      var lang = window._userdata && config.i18n[_userdata.user_lang] ?
        config.i18n[_userdata.user_lang] : config.i18n.en
      ;
 
      var submitted = false;
 
      $('form[name="form_login"]').on('submit', function(event) {
        var $this = $(this);
   
        var $username = $this.find('input[name="username"]');
   
        if ($username.val().indexOf('@') === -1 || submitted) {
            $this.append('<input type="hidden" value="1" name="login" />');
            return true;
        }
   
        $this
            .find('input[type="submit"]')
            .val(lang.loading)
            .prop('disabled', true)
            .css('opacity', 0.5)
        ;
   
        $.get('/memberlist', {
            change_version: 'modernbb',
            mode: 'username',
            order: 'DESC',
            submit: true,
            username: $username.val()
        }, function(context) {
            var $name = $('.avatar-mini:first', context);
       
            if ($name.length) {
              $username.val($name.text().trim());
            }       
       
            submitted = true;
            $this.submit();
        });
   
        event.preventDefault();
      });
  });
}(jQuery));
pedxz
pedxz
Forumember

Posts : 464
Reputation : 121
Language : 🇵🇹

View user profile https://www.forumotion.com/create-forum/modernbb

Niko, TonnyKamper and Simone Boi like this post

Back to top Go down

Solved Re: Popup login with Email integration

Post by Simone Boi February 6th 2021, 1:41 pm

That worked! Thank you a lot! I really wanted it
avatar
Simone Boi
Forumember

Posts : 65
Reputation : 1
Language : Italian

View user profile https://gamespledge.forumattivo.com/

pedxz likes this post

Back to top Go down

Solved Re: Popup login with Email integration

Post by Ape February 6th 2021, 3:27 pm

Problem solved & topic archived.
Please read our forum rules: ESF General Rules

Thank you @pedxz for your help here buddy Wink


Popup login with Email integration Left1212Popup login with Email integration Center11Popup login with Email integration Right112
Popup login with Email integration Ape_b110
Popup login with Email integration Keep_s10
Popup login with Email integration Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 16529
Reputation : 1774
Language : fluent in dork / mumbojumbo & English haha

View user profile http://chatworld.forumotion.co.uk/

TonnyKamper and pedxz like this post

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum