From: Ryan Campbell Date: Mon, 24 May 2010 18:15:05 +0000 (-0600) Subject: Convert API key to uppercase on input X-Git-Tag: v0.4-7~1 X-Git-Url: http://git.maemo.org/git/?p=mevemon;a=commitdiff_plain;h=ade474a0cbe1266cfcf25cea381897b76c8530a3 Convert API key to uppercase on input 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. --- diff --git a/package/src/ui/diablo/gui.py b/package/src/ui/diablo/gui.py index bf87b1a..3038f4b 100644 --- a/package/src/ui/diablo/gui.py +++ b/package/src/ui/diablo/gui.py @@ -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) diff --git a/package/src/ui/fremantle/gui.py b/package/src/ui/fremantle/gui.py index ef76e7e..8b8d1f7 100644 --- a/package/src/ui/fremantle/gui.py +++ b/package/src/ui/fremantle/gui.py @@ -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) diff --git a/package/src/validation.py b/package/src/validation.py index a544c42..4643b16 100644 --- a/package/src/validation.py +++ b/package/src/validation.py @@ -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