Page Index Toggle Pages: [1] 2 
Topic Tools
Hot Topic (More than 10 Replies) Login tab from Reset password screen (Read 1,905 times)
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 2,387
Location: Earth

YaBB 2.6.1
Login tab from Reset password screen
Aug 14th, 2012 at 7:07pm
Post Tools
After asking for a password reset, the Login tab takes users to a login screen that doesn't actually work properly. The 'Back' link takes the user to the BoardIndex.

The fix:
find
Code
Select All
		$tab{'login'} = qq~<span |><a href="~ . ($loginform ? "javascript:if(jumptologin>1)alert('$maintxt{'35'}');jumptologin++;window.scrollTo(0,10000);document.loginform.username.focus();" : "$scripturl?action=login$sesredir") . qq~" title = "$img_txt{'34'}" style="padding: 3px 0 4px 0;">$tabfill$img_txt{'34'}$tabfill</a></span>~;
 



replace with:
Code
Select All
		$tab{'login'} = qq~<span |><a href="~ . ($loginform ? "javascript:if(jumptologin>1)alert('$maintxt{'35'}');jumptologin++;window.scrollTo(0,10000);document.loginform.username.focus();" : "$scripturl?action=login") . qq~" title = "$img_txt{'34'}" style="padding: 3px 0 4px 0;">$tabfill$img_txt{'34'}$tabfill</a></span>~; 



I've tested this on my testboard and does appear to work.

  

If you only have one solution to a problem you're not trying hard enough!
Back to top
WWW  
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Login tab from Reset password screen
Reply #1 - Aug 23rd, 2012 at 8:14pm
Post Tools
That's not a good thing to do I'm afraid - it will break the redirect feature, so you'll be redirected to the Board Index instead of the page you were viewing before you logged in. Wink
  
Back to top
 
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Login tab from Reset password screen
Reply #2 - Aug 23rd, 2012 at 8:53pm
Post Tools
In Sources/LogInOut.pl find:

Code (Perl)
Select All
        $FORM{'sredir'} = '' if $FORM{'sredir'} =~ /action=(register|login2)/; 


And replace with:

Code (Perl)
Select All
        $FORM{'sredir'} = '' if $FORM{'sredir'} =~ /action=(register|login2|reminder|reminder2)/; 


Smiley
« Last Edit: Aug 24th, 2012 at 12:08am by Derek Barnstorm »  
Back to top
 
IP Logged
 
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 2,387
Location: Earth

YaBB 2.6.1
Re: Login tab from Reset password screen
Reply #3 - Aug 23rd, 2012 at 8:54pm
Post Tools
But when you use the login tab from the password reset screen it takes you to a login screen that gives you errors like: 'The Verification code was not filled out. It is required. '  (It logs you in but with bizarre errors.)

The regular (non-redirected) login page doesn't do that. (And I didn't change the redirect for the 'back' link. That goes 'back' like it's supposed to.)

Edited:
And now I see you've posted some code.

« Last Edit: Aug 23rd, 2012 at 8:57pm by Dandello »  

If you only have one solution to a problem you're not trying hard enough!
Back to top
WWW  
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Login tab from Reset password screen
Reply #4 - Aug 23rd, 2012 at 9:00pm
Post Tools
Yep. It throws the errors because you are redirected back to 'reminder2', but no information has been passed through the form - so with the code I posted, you will be redirected to the board index.
  
Back to top
 
IP Logged
 
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 2,387
Location: Earth

YaBB 2.6.1
Re: Login tab from Reset password screen
Reply #5 - Aug 23rd, 2012 at 10:27pm
Post Tools
My solution was to simply change the link in the login tab (in TabMenu.pl) to 'action=login' and forget the other stuff. And knowing how I've been forgetting to add explanations, I probably forgot to add which file had to be edited.  Embarrassed



« Last Edit: Aug 23rd, 2012 at 10:38pm by Dandello »  

If you only have one solution to a problem you're not trying hard enough!
Back to top
WWW  
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Login tab from Reset password screen
Reply #6 - Aug 23rd, 2012 at 10:35pm
Post Tools
Your solution breaks the redirect feature - test it. My solution is the correct way to do it.

All you did is remove the '$sesredir' variable which is absolutely needed. Smiley

« Last Edit: Aug 23rd, 2012 at 10:36pm by Derek Barnstorm »  
Back to top
 
IP Logged
 
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 2,387
Location: Earth

YaBB 2.6.1
Re: Login tab from Reset password screen
Reply #7 - Aug 23rd, 2012 at 10:51pm
Post Tools
Not utterly convinced the sesredir is needed from that screen BUT, your solution no doubt breaks fewer things.  Wink
  

If you only have one solution to a problem you're not trying hard enough!
Back to top
WWW  
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Login tab from Reset password screen
Reply #8 - Aug 23rd, 2012 at 10:55pm
Post Tools
Dandello wrote on Aug 23rd, 2012 at 10:51pm:
Not utterly convinced the sesredir is needed from that screen

That's the whole point in this line of code:

Code (Perl)
Select All
        $FORM{'sredir'} = '' if $FORM{'sredir'} =~ /action=(register|login2|reminder|reminder2)/; 


« Last Edit: Aug 23rd, 2012 at 10:56pm by Derek Barnstorm »  
Back to top
 
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Login tab from Reset password screen
Reply #9 - Aug 23rd, 2012 at 11:09pm
Post Tools
On a related note, I don't think you should be able to access the login and reminder pages when you are logged in.

Still in Sources/LogInOut.pl find:

Code (Perl)
Select All
sub Login2 { 


And add after:

Code (Perl)
Select All
    if (!$iamguest) { &fatal_error("logged_in_already",$username); } 


Find:

Code (Perl)
Select All
sub Login { 


And add after:

Code (Perl)
Select All
    if (!$iamguest) { &fatal_error("logged_in_already",$username); } 


Find:

Code (Perl)
Select All
sub Reminder { 


And add after:

Code (Perl)
Select All
    if (!$iamguest) { &fatal_error("logged_in_already",$username); } 


Find:

Code (Perl)
Select All
sub Reminder2 { 


And add after:

Code (Perl)
Select All
    if (!$iamguest) { &fatal_error("logged_in_already",$username); } 


Edited:
Edited by Dandello to make a correction
« Last Edit: Aug 26th, 2012 at 3:38pm by Dandello »  
Back to top
 
IP Logged
 
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 2,387
Location: Earth

YaBB 2.6.1
Re: Login tab from Reset password screen
Reply #10 - Aug 23rd, 2012 at 11:31pm
Post Tools
I love bug fixes.  Cheesy

But you might want to look at this:
Code (Javascript)
Select All
<a href="javascript:history.go(-1)"> 



From the password reminder confirmation screen it takes you one back - to the Reminder screen. Maybe it needs to be
Code (Javascript)
Select All
<a href="javascript:history.go(-2)"> 

to take you all the way back to where you asked for the password reminder? Just an observation.

  

If you only have one solution to a problem you're not trying hard enough!
Back to top
WWW  
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Login tab from Reset password screen
Reply #11 - Aug 23rd, 2012 at 11:52pm
Post Tools
Yep, seems good to me. Looks like I'd actually got a bit mixed up with the back link in the 'fatal_error' sub, so I'll leave it with you if you want to leave it as it was (linking to the board index) or use JS to go back. I guess it makes more sense your way though, seeing as it is a 'go back' link...
« Last Edit: Aug 23rd, 2012 at 11:54pm by Derek Barnstorm »  
Back to top
 
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Login tab from Reset password screen
Reply #12 - Aug 24th, 2012 at 12:06am
Post Tools
Actually, thinking about it, some users like to link directly to the reminder page from the tab menu or some other place, so using JS to go back two pages could potentially end up taking you to a page which isn't even on your own website - I think it's probably best just to leave it as it was linking to the board index - I'll remove that edit from Reply #2 now - my mistake!

The text should maybe be changed to "Go to the Board Index" though...
« Last Edit: Aug 24th, 2012 at 12:58pm by Derek Barnstorm »  
Back to top
 
IP Logged
 
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 2,387
Location: Earth

YaBB 2.6.1
Re: Login tab from Reset password screen
Reply #13 - Aug 24th, 2012 at 4:57am
Post Tools
I like that solution.  Grin
  

If you only have one solution to a problem you're not trying hard enough!
Back to top
WWW  
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Login tab from Reset password screen
Reply #14 - Aug 24th, 2012 at 12:57pm
Post Tools
Okay. The best place to add it then would be Languages/English/Main.lng so that it can be re-used wherever.

Find:

Code (Perl)
Select All
'noscript' => 'You must enable JavaScript to get full functionality for this forum!', 


And add after:

Code (Perl)
Select All
'go_to_board' => 'Go to the Board Index', 


Then in Sources/LogInOut.pl change:

Code (HTML)
Select All
<br /><p align="center"><a href="$scripturl">$loginout_txt{'193'}</a></p><br /> 


To:

Code (HTML)
Select All
<br /><p align="center"><a href="$scripturl">$maintxt{'go_to_board'}</a></p><br /> 

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Topic Tools
 
  « Board Index ‹ Board  ^Top