improve login warnings (diff attached)

churl2

New member
Apologies if I'm in the wrong forum, but I'm sure where the right place is for this.
Here's a minor patch that improves the login error message.

Code:
Index: src/net/sourceforge/kolmafia/request/LoginRequest.java
===================================================================
--- src/net/sourceforge/kolmafia/request/LoginRequest.java      (revision 8215)
+++ src/net/sourceforge/kolmafia/request/LoginRequest.java      (working copy)
@@ -321,7 +321,9 @@
                if ( this.responseText.indexOf( "Too many" ) != -1 )
                {
                        // Too many bad logins in too short a time span.
-                       KoLmafia.updateDisplay( KoLConstants.ABORT_STATE, "Too many failed login attempts." );
+            int pos = this.responseText.indexOf("Too many");
+            int pos2 = this.responseText.indexOf("<",pos+1);
+                       KoLmafia.updateDisplay( KoLConstants.ABORT_STATE, this.responseText.substring(pos,pos2));
                        return;
                }
 

fronobulax

Developer
Staff member
Apologies if I'm in the wrong forum, but I'm sure where the right place is for this.
Here's a minor patch that improves the login error message.
I'm lazy or dense. What is the login message with and without your patch? Has anyone with write access at SourceForge commented about this? If no one thinks it is a bad idea or has done it already, I will check it in for you although I won't get a chance until the weekend. PM me since I often forget things :eek:
 

churl2

New member
Without the patch, the message you see is "Too many failed login attempts." With the patch, you'll see "Too many failed login attempts -- try again in X minutes", or whatever else kingdomofloathing.com tells you. You just see a more informative error message.
 

fronobulax

Developer
Staff member
Without the patch, the message you see is "Too many failed login attempts." With the patch, you'll see "Too many failed login attempts -- try again in X minutes", or whatever else kingdomofloathing.com tells you. You just see a more informative error message.
That's funny. I could have sworn that mafia had a counter that told me how long it was going to wait until it tried to log in again. I remember something like "Retrying login in X seconds" where X would count down by 15 until there were 15 seconds left and then by one until it actually tried to log in. Looks like I have some experiments to try since my memory is clearly suspect...
 

fronobulax

Developer
Staff member
So I added the patch and rebuilt. I logged in a character in a browser. I closed the browser. I then tried to log in via mafia. There was an unreadable flash of text and then the countdown. Exactly what happened without the patch except for the flash. Since, for all practical purposes, the patch has no effect or benefit that I can observe, my inclination is to not bother. I am willing to be convinced otherwise. Anyone who disagrees is certainly welcome to explicitly ask veracity.
 

churl2

New member
fronobulax: I wrote this patch in the first place because there are definitely use cases where I would see the result.
Mafia does not always go on to a countdown message. It certainly doesn't for me. BTW, kol sometimes tells you come back in 1 minute, and sometimes tells you to come back in 5 minutes -- which is what this patch will reveal.
 

churl2

New member
With the patch, I currently see "Too many login attempts in too short a span of time. Please wait five minutes and try again."
 

fronobulax

Developer
Staff member
I admit to being hyper conservative when it comes to checking in code that I did not personally write, test or notice was needed. Some of that is just being gun-shy after a supposedly trivial change that compiled for me but not several others.

I suspect my failure to see the utility has a lot to do with the fact that rollover is after my bedtime so I never have any need to deal with rollover related issues. If there are different cases when KoL reports different wait times after a failed log in then I can see why a message that helps the user distinguish between them is of some utility - even if it goes by so quickly that I cannot read it. I'll trust you when you say the change does that.

Bottom line - I'll make and submit the change later today.

Edit: Done. r8228 Palindrome noted ;)
 
Last edited:
Top