diff --git a/src/Jackett/Indexers/TehConnection.cs b/src/Jackett/Indexers/TehConnection.cs
index 1f9a459088ab1afe74668f324af415c442e659fc..e62ab5f19213f3f2743ced7cdabd0f56dc31b9db 100644
--- a/src/Jackett/Indexers/TehConnection.cs
+++ b/src/Jackett/Indexers/TehConnection.cs
@@ -1,5 +1,4 @@
 using CsQuery;
-using Jackett.Indexers;
 using Jackett.Models;
 using Jackett.Services;
 using Jackett.Utils;
@@ -41,27 +40,35 @@ namespace Jackett.Indexers
                                                                         Separate options with a space if using more than one option.<br>Filter options available:
                                                                         <br><code>QualityEncodeOnly</code><br><code>FreeLeechOnly</code>"))
         {
-            AddCategoryMapping(7, TorznabCatType.Movies);
-            AddCategoryMapping(7, TorznabCatType.MoviesForeign);
-            AddCategoryMapping(7, TorznabCatType.MoviesOther);
-            AddCategoryMapping(7, TorznabCatType.MoviesSD);
-            AddCategoryMapping(7, TorznabCatType.MoviesHD);
-            AddCategoryMapping(7, TorznabCatType.Movies3D);
-            AddCategoryMapping(7, TorznabCatType.MoviesBluRay);
-            AddCategoryMapping(7, TorznabCatType.MoviesDVD);
-            AddCategoryMapping(7, TorznabCatType.MoviesWEBDL);
+            AddCategoryMapping(1, TorznabCatType.Movies);
+            AddCategoryMapping(1, TorznabCatType.MoviesForeign);
+            AddCategoryMapping(1, TorznabCatType.MoviesOther);
+            AddCategoryMapping(1, TorznabCatType.MoviesSD);
+            AddCategoryMapping(1, TorznabCatType.MoviesHD);
+            AddCategoryMapping(1, TorznabCatType.Movies3D);
+            AddCategoryMapping(1, TorznabCatType.MoviesBluRay);
+            AddCategoryMapping(1, TorznabCatType.MoviesDVD);
+            AddCategoryMapping(1, TorznabCatType.MoviesWEBDL);
         }
 
         public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
         {
             configData.LoadValuesFromJson(configJson);
+
+            await DoLogin();
+
+            return IndexerConfigurationStatus.RequiresTesting;
+        }
+
+        private async Task DoLogin()
+        {
             var pairs = new Dictionary<string, string> {
                 { "username", configData.Username.Value },
                 { "password", configData.Password.Value },
                 { "keeplogged", "1" },
                 { "login", "Log In!" }
             };
-         
+
             var response = await RequestLoginAndFollowRedirect(LoginUrl, pairs, null, true, indexUrl, SiteLink);
 
             await ConfigureIfOK(response.Cookies, response.Content != null && response.Content.Contains("/logout.php"), () =>
@@ -70,11 +77,24 @@ namespace Jackett.Indexers
                 string errorMessage = "Unable to login to TehConnection";
                 throw new ExceptionWithConfigData(errorMessage, configData);
             });
-            return IndexerConfigurationStatus.RequiresTesting;
         }
 
         public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
         {
+            var loggedInCheck = await RequestStringWithCookies(SearchUrl);
+            if (!loggedInCheck.Content.Contains("/logout.php"))
+            {
+                //Cookie appears to expire after a period of time or logging in to the site via browser
+                DateTime lastLoggedInCheck;
+                DateTime.TryParse(configData.LastLoggedInCheck.Value, out lastLoggedInCheck);
+                if (lastLoggedInCheck < DateTime.Now.AddMinutes(-15))
+                {
+                    await DoLogin();
+                    configData.LastLoggedInCheck.Value = DateTime.Now.ToString("o");
+                    SaveConfig();
+                }
+            }
+
             var releases = new List<ReleaseInfo>();
             bool configFreeLeechOnly = configData.FilterString.Value.ToLowerInvariant().Contains("freeleechonly");
             bool configQualityEncodeOnly = configData.FilterString.Value.ToLowerInvariant().Contains("qualityencodeonly");
diff --git a/src/Jackett/Models/IndexerConfig/ConfigurationDataBasicLoginWithFilter.cs b/src/Jackett/Models/IndexerConfig/ConfigurationDataBasicLoginWithFilter.cs
index 10a029db2c235a0f7c5a6c878b2bc51b888412e1..8409121a990c6679e6345d4453a6ffaa624d2b84 100644
--- a/src/Jackett/Models/IndexerConfig/ConfigurationDataBasicLoginWithFilter.cs
+++ b/src/Jackett/Models/IndexerConfig/ConfigurationDataBasicLoginWithFilter.cs
@@ -11,6 +11,7 @@ namespace Jackett.Models.IndexerConfig
     {
         public StringItem Username { get; private set; }
         public StringItem Password { get; private set; }
+        public HiddenItem LastLoggedInCheck { get; private set; }
         public DisplayItem FilterExample { get; private set; }
         public StringItem FilterString { get; private set; }
         
@@ -18,6 +19,7 @@ namespace Jackett.Models.IndexerConfig
         {
             Username = new StringItem { Name = "Username" };
             Password = new StringItem { Name = "Password" };
+            LastLoggedInCheck = new HiddenItem { Name = "LastLoggedInCheck" };
             FilterExample = new DisplayItem(FilterInstructions)
             {
                 Name = ""