diff --git a/app/components/auth/auth.html b/app/components/auth/auth.html
index fe53cc0b5..f58276395 100644
--- a/app/components/auth/auth.html
+++ b/app/components/auth/auth.html
@@ -16,7 +16,7 @@
-
+
diff --git a/app/components/initAdmin/initAdmin.html b/app/components/initAdmin/initAdmin.html
index 775a1b5e9..6fbcccaf9 100644
--- a/app/components/initAdmin/initAdmin.html
+++ b/app/components/initAdmin/initAdmin.html
@@ -36,7 +36,7 @@
diff --git a/app/directives/autofocus.js b/app/directives/autofocus.js
new file mode 100644
index 000000000..0b9029c33
--- /dev/null
+++ b/app/directives/autofocus.js
@@ -0,0 +1,14 @@
+angular
+.module('portainer')
+.directive('autoFocus', ['$timeout', function porAutoFocus($timeout) {
+ var directive = {
+ restrict: 'A',
+ link: function($scope, $element) {
+ $timeout(function() {
+ $element[0].focus();
+ });
+ }
+ };
+
+ return directive;
+}]);