diff --git a/.gitignore b/.gitignore
index 4a3d6357..f173f672 100644
--- a/.gitignore
+++ b/.gitignore
@@ -72,6 +72,7 @@ msbuild.wrn
# Test caches
*.pyc
+*.pyo
.pytest_cache/
.tox/
diff --git a/addon.py b/addon.py
index 1e1d201f..14771fc8 100644
--- a/addon.py
+++ b/addon.py
@@ -35,6 +35,17 @@ def delete_tokens():
tokenresolver.TokenResolver(kodi).delete_tokens()
+@plugin.route('/tokens/check-credentials')
+def check_credentials():
+ ''' Check if the credentials are correct '''
+ from resources.lib import tokenresolver
+ if tokenresolver.TokenResolver(kodi).check_credentials():
+ kodi.show_ok_dialog(message=kodi.localize(30980))
+ else:
+ kodi.show_ok_dialog(message=kodi.localize(30952))
+ kodi.open_settings()
+
+
@plugin.route('/widevine/install')
def install_widevine():
''' The API interface to install Widevine '''
diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po
index 01e6da7a..dbcd4c88 100644
--- a/resources/language/resource.language.en_gb/strings.po
+++ b/resources/language/resource.language.en_gb/strings.po
@@ -391,6 +391,14 @@ msgctxt "#30806"
msgid "Provide your VRT NU account password."
msgstr ""
+msgctxt "#30807"
+msgid "Check credentials"
+msgstr ""
+
+msgctxt "#30808"
+msgid "Check if your VRT NU credentials are correct."
+msgstr ""
+
msgctxt "#30820"
msgid "Interface"
msgstr ""
@@ -672,3 +680,7 @@ msgstr ""
msgctxt "#30979"
msgid "Because of important internal changes, existing Kodi favourites and watched history from VRT NU no longer work.\n[B]Please recreate all your VRT NU favourites.[/B]"
msgstr ""
+
+msgctxt "#30980"
+msgid "Login successful!"
+msgstr ""
diff --git a/resources/language/resource.language.nl_nl/strings.po b/resources/language/resource.language.nl_nl/strings.po
index 1dfd36a8..256ec00d 100644
--- a/resources/language/resource.language.nl_nl/strings.po
+++ b/resources/language/resource.language.nl_nl/strings.po
@@ -287,6 +287,14 @@ msgctxt "#30805"
msgid "Password"
msgstr "Wachtwoord"
+msgctxt "#30807"
+msgid "Check credentials"
+msgstr "Controleer inloggegevens"
+
+msgctxt "#30808"
+msgid "Check if your VRT NU credentials are correct."
+msgstr "Controleer of je VRT NU inloggegevens correct zijn."
+
msgctxt "#30820"
msgid "Interface"
msgstr "Interface"
@@ -565,3 +573,6 @@ msgctxt "#30979"
msgid "Because of important internal changes, existing Kodi favourites and watched history from VRT NU no longer work.\n[B]Please recreate all your VRT NU favourites.[/B]"
msgstr "Wegens belangrijke interne wijzigingen werken bestaande Kodi-favorieten en kijkgeschiedenis van VRT NU niet meer.\n[B]Gelieve al uw VRT NU-favorieten opnieuw aan te maken.[/B]"
+msgctxt "#30980"
+msgid "Login successful!"
+msgstr "Inloggen gelukt!"
diff --git a/resources/lib/tokenresolver.py b/resources/lib/tokenresolver.py
index fb88f7ba..9ef496ca 100644
--- a/resources/lib/tokenresolver.py
+++ b/resources/lib/tokenresolver.py
@@ -80,6 +80,26 @@ def get_xvrttoken(self, token_variant=None):
token = self._get_new_xvrttoken(token_variant)
return token
+ def check_credentials(self):
+ ''' Check the credentials '''
+ cred = Credentials(self._kodi)
+ if not cred.are_filled_in():
+ return False
+
+ payload = dict(
+ loginID=cred.username,
+ password=cred.password,
+ sessionExpiration='-1',
+ APIKey=self._API_KEY,
+ targetEnv='jssdk',
+ )
+ data = urlencode(payload).encode('utf8')
+ self._kodi.log_notice('URL post: ' + unquote(self._LOGIN_URL), 'Verbose')
+ req = Request(self._LOGIN_URL, data=data)
+ logon_json = json.load(urlopen(req))
+
+ return logon_json.get('errorCode') == 0
+
def _get_token_path(self, token_name, token_variant):
''' Create token path following predefined file naming rules '''
prefix = token_variant + '_' if token_variant else ''
diff --git a/resources/settings.xml b/resources/settings.xml
index b270d0fc..7a022e2e 100644
--- a/resources/settings.xml
+++ b/resources/settings.xml
@@ -5,6 +5,7 @@
+