diff --git a/login_security.module b/login_security.module
index 1e473c8..cc49f6b 100644
--- a/login_security.module
+++ b/login_security.module
@@ -61,6 +61,8 @@ function login_security_form_alter(array &$form, FormStateInterface $form_state,
     }
 
     $form['#validate'][] = 'login_security_validate';
+    $form['#validate'][] = '::validateAuthentication';
+    $form['#validate'][] = '::validateFinal';
     $form['#submit'][] = 'login_security_submit';
   }
 }
@@ -190,13 +192,23 @@ function login_security_validate(array $form, FormStateInterface $form_state) {
       login_user_block_ip($variables, $form_state);
     }
   }
-
+  $request_time = \Drupal::time()->getRequestTime();
+  $trackTime =   \Drupal::database()->select('login_security_track', 'time')
+  ->fields('time', array('timestamp'))
+  ->condition('name', $name)
+  ->execute()
+  ->fetchField();
+  $unblock_request = $trackTime + ($variables['@user_unblock_time'] * 60);
   // Check for user login attempts.
   if ($variables['@user_block_attempts'] >= 1) {
-    if ($variables['@user_current_count'] >= $variables['@user_block_attempts']) {
+    if ($variables['@user_current_count'] >= $variables['@user_block_attempts'] && $request_time <= $unblock_request ) {
       // Block the account $name.
       login_user_block_user_name($variables, $form_state);
     }
+    // Unlock the account same
+    else{
+      login_user_unblock_user_name($variables, $form_state);
+    }
   }
 
   // At this point, they're either logged in or not by Drupal core's abuse of
@@ -400,6 +412,37 @@ function login_user_block_user_name($variables, FormStateInterface $form_state)
     }
   }
 }
+/**
+ * Unlock a user by username
+ */
+
+ function login_user_unblock_user_name($variables, FormStateInterface $form_state) {
+  $conf = \Drupal::config('login_security.settings');
+  // If the user exists.
+  if ($variables['@uid'] > 1) {
+    // Modifying the user table is not an option so it disables the user hooks.
+    // Need to do firing the hook so user_notifications can be used.
+    $uid = $variables['@uid'];
+    $account = User::load($uid);
+    // Block account if is active.
+    if ($account->status->value == 0) {
+      $account->status->setValue(1);
+      $account->save();
+      // The watchdog alert is set to 'user' so it will show with other blocked
+      // user messages.
+      \Drupal::logger('login_security')->notice('Unlocked user @username after the specified time in config.', $variables);
+      $form_errors = $form_state->getErrors();
+      // Clear the form errors.
+      $form_state->clearErrors();
+      // Remove the field_mobile form error.
+      unset($form_errors['name']);
+      // Now loop through and re-apply the remaining form error messages.
+      foreach ($form_errors as $name => $error_message) {
+        $form_state->setErrorByName($name, $error_message);
+      }
+    }
+  }
+}
 
 /**
  * Returns the user object, of the users exists, otherwise the anonymous user.
@@ -455,6 +498,7 @@ function _login_security_get_variables_by_name($name = NULL) {
     '@hard_block_attempts' => $config->get('host_wrong_count_hard'),
     '@soft_block_attempts' => $config->get('host_wrong_count'),
     '@user_block_attempts' => $config->get('user_wrong_count'),
+    '@user_unblock_time' => $config->get('unblock_time'),
     '@user_ip_current_count' => \Drupal::database()->select('login_security_track', 'lst')
       ->fields('lst', ['id'])
       ->condition('name', $name)
diff --git a/src/Form/LoginSecurityAdminSettings.php b/src/Form/LoginSecurityAdminSettings.php
index 39515dc..961462a 100644
--- a/src/Form/LoginSecurityAdminSettings.php
+++ b/src/Form/LoginSecurityAdminSettings.php
@@ -187,7 +187,16 @@ class LoginSecurityAdminSettings extends ConfigFormBase {
       '#title' => $this->t('Tokens'),
       '#description' => $this->t("<ul><li>%date: The (formatted) date and time of the event.</li><li>%ip: The IP address tracked for this event.</li><li>%username: The username entered in the login form (sanitized).</li><li>%email: If the user exists, this will be the email address.</li><li>%uid: If the user exists, this will be the user uid.</li><li>%site: The name of the site as configured in the administration.</li><li>%uri: The base url of this Drupal site.</li><li>%edit_uri: Direct link to the user (based on the name entered) edit page.</li><li>%hard_block_attempts: Configured maximum attempts before hard blocking the IP address.</li><li>%soft_block_attempts: Configured maximum attempts before soft blocking the IP address.</li><li>%user_block_attempts: Configured maximum login attempts before blocking the user.</li><li>%user_ip_current_count: The total attempts for this user name tracked from this IP address.</li><li>%ip_current_count: The total login attempts tracked from from this IP address.</li><li>%user_current_count: The total login attempts tracked for this user name .</li><li>%tracking_time: The tracking time value: in hours.</li><li>%tracking_current_count: Total tracked events</li><li>%activity_threshold: Value of attempts to detect ongoing attack.</li></ul>"),
     ];
-
+    // Field to get unblock time
+    $form['general_settings']['unblock_time'] = [
+      '#type' => 'number',
+      '#min' => 0,
+      '#title' => $this->t('Unblock Time'),
+      '#default_value' => $config->get('unblock_time'),
+      '#size' => 3,
+      '#description' => $this->t('User will be unblocked after this time.'),
+      '#field_suffix' => $this->t('minute(s)'),
+    ];
     // Clean event tracking list.
     $form['actions']['clean_tracked_events'] = [
       '#type' => 'submit',
@@ -204,6 +213,7 @@ class LoginSecurityAdminSettings extends ConfigFormBase {
   public function submitForm(array &$form, FormStateInterface $form_state) {
     $this->configFactory()->getEditable('login_security.settings')
       ->set('track_time', $form_state->getValue('track_time'))
+      ->set('unblock_time', $form_state->getValue('unblock_time'))
       ->set('user_wrong_count', $form_state->getValue('user_wrong_count'))
       ->set('host_wrong_count', $form_state->getValue('host_wrong_count'))
       ->set('host_wrong_count_hard', $form_state->getValue('host_wrong_count_hard'))
