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.

Switch Accounts issues

5 posters

Go down

Solved Switch Accounts issues

Post by RinRose7 January 13th 2021, 9:29 pm

So, a friend recently showed me a switch Accounts code to use. Which is fine and dandy but it doesn't appear to work. Of course I'm using the latest version (AwesomeBB) which I know/from what I can tell is still in beta mode but, if there's any chance to get a switch account coding for AwesomeBB that would be helpful. And my friend and I tried several different ones too but none seemed to work.


Last edited by RinRose7 on January 24th 2021, 5:48 pm; edited 1 time in total
RinRose7
RinRose7
New Member

Other / Decline to state Posts : 13
Reputation : 2
Language : English

https://talesofioshora.forumotion.com/

Back to top Go down

Solved Re: Switch Accounts issues

Post by skouliki January 13th 2021, 9:32 pm

Hello
Can you post the code please
skouliki
skouliki
Manager
Manager

Female Posts : 15064
Reputation : 1690
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: Switch Accounts issues

Post by RinRose7 January 13th 2021, 9:35 pm

Code:
    <script type="text/javascript">
        function switch_accounts() {
        jQuery.get(document.getElementById('logout').href, function() {
        jQuery.post('/login', 'login=1&username='+document.getElementById('switch_uname').value+'&password='+document.getElementById('switch_pass').value, function () {
        window.location.reload();
        });
        });
        }
        </script>
        Switch user:<hr />
        <input id="switch_uname" type="text" /><br />
        <input id="switch_pass" type="password" /><br />
        <input type="button" value="Switch user" onclick="switch_accounts();" />

This was one of the many we tried. It seems to work on Phpbb but it doesn't seem to work on AwesomeBB. Another we've tried was for Invision only. One I found completely broke the site and didn't work.
RinRose7
RinRose7
New Member

Other / Decline to state Posts : 13
Reputation : 2
Language : English

https://talesofioshora.forumotion.com/

Back to top Go down

Solved Re: Switch Accounts issues

Post by skouliki January 14th 2021, 9:21 am

yes i have also the same code 
this code works for all versions besides Awesome
skouliki
skouliki
Manager
Manager

Female Posts : 15064
Reputation : 1690
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: Switch Accounts issues

Post by Niko January 14th 2021, 10:22 am

Dear @RinRose7

the code is fine, the only problem is that in AwesomeBB the logout element does not have the ID #logout to which the code refers. You only need to update the code with the following:

Code:
<script type="text/javascript">
var logout = $('#main-user-menu ul:last li a:last').attr('href');
        function switch_accounts() {
        jQuery.get(logout, function() {
        jQuery.post('/login', 'login=1&username='+document.getElementById('switch_uname').value+'&password='+document.getElementById('switch_pass').value, function () {
        window.location.reload();
        });
        });
        }
        </script>
        Switch user:<hr />
        <input id="switch_uname" type="text" /><br />
        <input id="switch_pass" type="password" /><br />
        <input type="button" value="Switch user" onclick="switch_accounts();" />

The code works for me, but it may not for you. In any case, could you share the resource where you found the code (a tutorial or something)?

Thanks in advance :rose:
Niko
Niko
Helper
Helper

Male Posts : 3100
Reputation : 244
Language : English, Italian, French
Location : Italy

https://www.fmcodes.net/

skouliki and SarkZKalie like this post

Back to top Go down

Solved Re: Switch Accounts issues

Post by skouliki January 14th 2021, 11:50 am

i think the code is posted on ESF here by Ange if I am not mistaken
skouliki
skouliki
Manager
Manager

Female Posts : 15064
Reputation : 1690
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: Switch Accounts issues

Post by RinRose7 January 14th 2021, 4:05 pm

Thanks for the coding! It's popping up but, the issue I am having is, it not letting me click the 'switch user' button. Do I need to change the &logout to #logout? if that is what you mean? Sorry for the late response I just woke up and tested the code you sent.
RinRose7
RinRose7
New Member

Other / Decline to state Posts : 13
Reputation : 2
Language : English

https://talesofioshora.forumotion.com/

Back to top Go down

Solved Re: Switch Accounts issues

Post by Niko January 14th 2021, 4:15 pm

@RinRose7 try to replace the first part of the code with this:
Code:
$(function() {
var logout = $('#main-user-menu ul:last li a:last').attr('href');
        function switch_accounts() {
        jQuery.get(logout, function() {
        jQuery.post('/login', 'login=1&username='+document.getElementById('switch_uname').value+'&password='+document.getElementById('switch_pass').value, function () {
        window.location.reload();
        });
        });
        }
});

if it still doesn't work, I need to see it live and test it myself to understand the possible causes and problems occurring :rose:
Niko
Niko
Helper
Helper

Male Posts : 3100
Reputation : 244
Language : English, Italian, French
Location : Italy

https://www.fmcodes.net/

TonnyKamper likes this post

Back to top Go down

Solved Re: Switch Accounts issues

Post by RinRose7 January 14th 2021, 4:26 pm

Still having the same issues as I did beforehand. Won't let me click the 'Switch Account' and change users
RinRose7
RinRose7
New Member

Other / Decline to state Posts : 13
Reputation : 2
Language : English

https://talesofioshora.forumotion.com/

Back to top Go down

Solved Re: Switch Accounts issues

Post by skouliki January 14th 2021, 5:18 pm

I also tested and i have the same issue as RinRose7
skouliki
skouliki
Manager
Manager

Female Posts : 15064
Reputation : 1690
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

TonnyKamper likes this post

Back to top Go down

Solved Re: Switch Accounts issues

Post by Niko January 14th 2021, 7:53 pm

Can you guys provide me an example? Because I need to see it live to understand what happens thumright

and strangely it works for me, so I can't test it on my own Embarassed
Niko
Niko
Helper
Helper

Male Posts : 3100
Reputation : 244
Language : English, Italian, French
Location : Italy

https://www.fmcodes.net/

Back to top Go down

Solved Re: Switch Accounts issues

Post by RinRose7 January 14th 2021, 7:59 pm

I'm not very good at explaining it but, the button part for the "Switch Accounts" doesn't appear and even when I pressed the 'viewing' part for the code to show the login thing for switch accounts and click the button nothing happens. It's like a useless button that won't work. If you want I can even send a screen shot of how it looks on my screen with the code in and send a url of my own forum so you can try and click the switch user button.
RinRose7
RinRose7
New Member

Other / Decline to state Posts : 13
Reputation : 2
Language : English

https://talesofioshora.forumotion.com/

Back to top Go down

Solved Re: Switch Accounts issues

Post by Niko January 14th 2021, 8:36 pm

@RinRose7 sorry, maybe I didn't explain myself... I need to see it on my own!
I need to register on your website and test it personally - because of that I need to know where i will be able to find it :rose:

If you want I can even send a screen shot of how it looks on my screen with the code in and send a url of my own forum so you can try and click the switch user button.
Yes please, for both of them Glasses
Niko
Niko
Helper
Helper

Male Posts : 3100
Reputation : 244
Language : English, Italian, French
Location : Italy

https://www.fmcodes.net/

Back to top Go down

Solved Re: Switch Accounts issues

Post by RinRose7 January 14th 2021, 8:44 pm

Sent the DM. Sorry for the late response to this. Hopefully, we can figure it out ;u;
RinRose7
RinRose7
New Member

Other / Decline to state Posts : 13
Reputation : 2
Language : English

https://talesofioshora.forumotion.com/

Back to top Go down

Solved Re: Switch Accounts issues

Post by RinRose7 January 19th 2021, 2:09 am

bumping this-
RinRose7
RinRose7
New Member

Other / Decline to state Posts : 13
Reputation : 2
Language : English

https://talesofioshora.forumotion.com/

Back to top Go down

Solved Re: Switch Accounts issues

Post by Niko January 21st 2021, 11:24 am

Dear @RinRose7

sorry for the late reply. Based on what I see from the screenshot you sent me - the code is not the same. You have
Code:
&#36
instead of
Code:
$

Please re-check the code you copy/paste, the one I shared with you was correct :rose:

Niko
Niko
Helper
Helper

Male Posts : 3100
Reputation : 244
Language : English, Italian, French
Location : Italy

https://www.fmcodes.net/

Back to top Go down

Solved Re: Switch Accounts issues

Post by RinRose7 January 22nd 2021, 4:37 pm

So I did do the right copy and paste link, but it keeps changing it to the &#36, how do I stop it from doing that?
RinRose7
RinRose7
New Member

Other / Decline to state Posts : 13
Reputation : 2
Language : English

https://talesofioshora.forumotion.com/

Back to top Go down

Solved Re: Switch Accounts issues

Post by skouliki January 22nd 2021, 4:39 pm

did you try to click the button "switch editor mode " when you paste the code ?
skouliki
skouliki
Manager
Manager

Female Posts : 15064
Reputation : 1690
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: Switch Accounts issues

Post by RinRose7 January 22nd 2021, 5:32 pm

No, I did not but even then it's still doing the same thing
RinRose7
RinRose7
New Member

Other / Decline to state Posts : 13
Reputation : 2
Language : English

https://talesofioshora.forumotion.com/

Back to top Go down

Solved Re: Switch Accounts issues

Post by skouliki January 22nd 2021, 5:50 pm

you are right i just tested it... its change automatically to me also
skouliki
skouliki
Manager
Manager

Female Posts : 15064
Reputation : 1690
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: Switch Accounts issues

Post by RinRose7 January 22nd 2021, 6:50 pm

I wonder why its doing that shfjksd
RinRose7
RinRose7
New Member

Other / Decline to state Posts : 13
Reputation : 2
Language : English

https://talesofioshora.forumotion.com/

Back to top Go down

Solved Re: Switch Accounts issues

Post by Niko January 23rd 2021, 8:09 pm

skouliki wrote:you are right i just tested it... its change automatically to me also

About this specific issue I do not know how to relate, because it is ACP side - maybe it is a bug?
Even if it's weird because the character
Code:
$
is the most used in jquery and javascript codes, so it's strange.

edit: I tried, and it happens for me as well.. it may be a problem to report Embarassed
In the meantime you can:
  1. Add the script code in Module > HTML & Javascript > Javascript management
    Code:
    var logout = $('#main-user-menu ul:last li a:last').attr('href');
            function switch_accounts() {
            jQuery.get(logout, function() {
            jQuery.post('/login', 'login=1&username='+document.getElementById('switch_uname').value+'&password='+document.getElementById('switch_pass').value, function () {
            window.location.reload();
            });
            });
            }

  2. Add only the second part in the widget
    Code:
    Switch user:<hr />
            <input id="switch_uname" type="text" /><br />
            <input id="switch_pass" type="password" /><br />
            <input type="button" value="Switch user" onclick="switch_accounts();" />


But in any case @skouliki I think this is something that should be reported to the Pro Admins Neutral
Niko
Niko
Helper
Helper

Male Posts : 3100
Reputation : 244
Language : English, Italian, French
Location : Italy

https://www.fmcodes.net/

skouliki, TonnyKamper and RinRose7 like this post

Back to top Go down

Solved Re: Switch Accounts issues

Post by RinRose7 January 24th 2021, 4:39 am

Okay so it seems to be clickable now but when I try to switch users it's not switching the users
RinRose7
RinRose7
New Member

Other / Decline to state Posts : 13
Reputation : 2
Language : English

https://talesofioshora.forumotion.com/

Back to top Go down

Solved Re: Switch Accounts issues

Post by Neptune- January 24th 2021, 3:02 pm

Hello,


I tried that way
Working but cannot see clearly where to put username and password. Maybe just a css issue on my side
Works and switch is ok

Code:
<script type="text/javascript">
                function switch_accounts() {
      jQuery('#main-user-menu li:last a').attr('id','logout');
                jQuery.get(document.getElementById('logout').href, function() {
                jQuery.post('/login', 'login=1&username='+document.getElementById('switch_uname').value+'&password='+document.getElementById('switch_pass').value, function () {
                window.location.reload();
                });
                });
                }
                </script>        Switch user:
<hr />
        <input id="switch_uname" type="text" /><br />        <input id="switch_pass" type="password" /><br />        <input type="button" value="Switch user" onclick="switch_accounts();" />

For the $ changed into &#36 its long known issue (same on the welcome message on index). Just change $ with jQuery and it's fine.
Neptune-
Neptune-
Forumember

Female Posts : 496
Reputation : 104
Language : French (10), English (8), CSS (5), HTML (4), Javascript (4)
Location : Scotland, UK

https://www.galaxie-series.net/

skouliki, TonnyKamper and RinRose7 like this post

Back to top Go down

Solved Re: Switch Accounts issues

Post by Ape January 24th 2021, 5:31 pm

@Neptune- as the switch accounts system is not a Forumotion fetcher We would not report it to our tech team.


Switch accounts - Switch Accounts issues Left1212Switch accounts - Switch Accounts issues Center11Switch accounts - Switch Accounts issues Right112
Switch accounts - Switch Accounts issues Ape_b110
Switch accounts - Switch Accounts issues Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19084
Reputation : 1988
Language : fluent in dork / mumbojumbo & English haha

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

Back to top Go down

Solved Re: Switch Accounts issues

Post by RinRose7 January 24th 2021, 5:48 pm

That worked :O Thank you so much for everyone's work!! I really appreciate it. Marking it as solved now!
RinRose7
RinRose7
New Member

Other / Decline to state Posts : 13
Reputation : 2
Language : English

https://talesofioshora.forumotion.com/

Niko and TonnyKamper like this post

Back to top Go down

Solved Re: Switch Accounts issues

Post by skouliki January 24th 2021, 7:06 pm

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

Female Posts : 15064
Reputation : 1690
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Back to top

- Similar topics

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