The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Popup login with Email integration

3 posters

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 : 90
Reputation : 2
Language : Italian

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 Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19324
Reputation : 2005
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

TonnyKamper, tikky 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 : 90
Reputation : 2
Language : Italian

https://gamespledge.forumattivo.com/

Ape likes this post

Back to top Go down

Solved Re: Popup login with Email integration

Post by tikky 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:
tikky
tikky
Forumember

Posts : 922
Reputation : 159
Language : 🇵🇹

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 : 90
Reputation : 2
Language : Italian

https://gamespledge.forumattivo.com/

Back to top Go down

Solved Re: Popup login with Email integration

Post by tikky 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));
tikky
tikky
Forumember

Posts : 922
Reputation : 159
Language : 🇵🇹

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 : 90
Reputation : 2
Language : Italian

https://gamespledge.forumattivo.com/

tikky 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 Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19324
Reputation : 2005
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

TonnyKamper and tikky like this post

Back to top Go down

Back to top

- Similar topics

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