Convert API key to uppercase on input
authorRyan Campbell <campbellr@gmail.com>
Mon, 24 May 2010 18:15:05 +0000 (12:15 -0600)
committerRyan Campbell <campbellr@gmail.com>
Mon, 24 May 2010 18:15:05 +0000 (12:15 -0600)
A user was having problems getting his credentials to work, it turns out that
the API key is case sensitive.

We now automatically convert the letters in the API key to
upper-case before adding it to gconf. This was the user can input either
lower-case or upper-case letters, and both will work.

package/src/ui/diablo/gui.py
package/src/ui/fremantle/gui.py
package/src/validation.py

index bf87b1a..3038f4b 100644 (file)
@@ -184,7 +184,8 @@ class BaseUI():
         while not valid_credentials:
             if result == gtk.RESPONSE_OK:
                 uid = uidEntry.get_text()
-                api_key = apiEntry.get_text()
+                # auth() fails if api_key has lower-case characters
+                api_key = apiEntry.get_text().upper()
             
                 try:
                     validation.uid(uid)
index ef76e7e..8b8d1f7 100644 (file)
@@ -185,7 +185,8 @@ class BaseUI():
         while not valid_credentials:
             if result == gtk.RESPONSE_OK:
                 uid = uidEntry.get_text()
-                api_key = apiEntry.get_text()
+                # auth() fails if api_key has lower-case characters
+                api_key = apiEntry.get_text().upper()
             
                 try:
                     validation.uid(uid)
index a544c42..4643b16 100644 (file)
@@ -21,6 +21,8 @@ def api_key(api_key):
         raise ValidationError("API Key must be %s characters" % KEY_SIZE)
     elif not api_key.isalnum():
         raise ValidationError("API Key must only contain alphanumeric characters")
+    elif not api_key.isupper():
+        raise ValidationError("API Key must only contain upper-case characters")
 
     return True