{"id":220,"date":"2011-12-24T01:22:12","date_gmt":"2011-12-24T07:22:12","guid":{"rendered":"http:\/\/csmartonline.com\/blog\/?p=220"},"modified":"2012-06-22T17:43:19","modified_gmt":"2012-06-22T23:43:19","slug":"clearos-automatically-focus-login-input-field","status":"publish","type":"post","link":"http:\/\/csmartonline.com\/blog\/2011\/12\/24\/clearos-automatically-focus-login-input-field\/","title":{"rendered":"ClearOS: Automatically focus login input field"},"content":{"rendered":"<p>I find it annoying to have to manually click &#8216;Login&#8217; on the login page when administering ClearOS. I use Firefox&#8217;s password manager and when I type my password for the password manager I am used to hitting enter twice, once to press &#8216;OK&#8217; for the password manager and once to submit the page since most login pages&#8217; input fields are automatically focused. This is not true for ClearOS&#8217;s login page but, today we are going to fix that.<\/p>\n<p>The fix is quite simple really. First you will need to SSH into ClearOS. Then find and edit your login page:<\/p>\n<pre class=\"snippet-code\">\r\nvi \/var\/webconfig\/htdocs\/templates\/standard-5.1\/widgets\/login.inc\r\n<\/pre>\n<p>Add the following just before the closing quote for the &#8216;echo&#8217; statement, which is located just before the &#8216;WebFormClose();&#8217; statement:<\/p>\n<pre class=\"snippet-code\">\r\n&lt;script type='text\/javascript'&gt;\r\ndocument.getElementsByName('reserved_username')[0].select();\r\n&lt;\/script&gt;\r\n<\/pre>\n<p>If you happen to be using a theme other than the standard, then you will need to adjust this tip accordingly. ie. Find the login page for your theme and edit the Javascript to suit your needs.<\/p>\n<p>That&#8217;s it! Congratulations, you&#8217;ve made the login page automatically focus it&#8217;s username field! Simple, eh?<\/p>\n<p><strong>UPDATE<\/strong>:<\/p>\n<p>For ClearOS 6, the file you&#8217;ll need to edit is &#8216;<strong>page.php<\/strong>&#8216; located at &#8216;<strong>\/usr\/clearos\/themes\/default\/core<\/strong>&#8216;. You&#8217;ll also need to replace &#8216;<strong>reserved_username<\/strong>&#8216; with &#8216;<strong>username<\/strong>&#8216; within the above script. You need to add the script just before the &#8216;<strong>&lt;\/body&gt;<\/strong>&#8216; tag under the section labeled &#8216;<strong>Returns login type page<\/strong>&#8216;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I find it annoying to have to manually click &#8216;Login&#8217; on the login page when administering ClearOS. I use Firefox&#8217;s password manager and when I type my password for the password manager I am used to hitting enter twice, once &hellip;<\/p>\n<p class=\"read-more\"><a href=\"http:\/\/csmartonline.com\/blog\/2011\/12\/24\/clearos-automatically-focus-login-input-field\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[45,70,71,69,47],"class_list":["post-220","post","type-post","status-publish","format-standard","hentry","category-tiptrick","tag-clearos","tag-field","tag-focus","tag-input","tag-login"],"_links":{"self":[{"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/posts\/220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/comments?post=220"}],"version-history":[{"count":9,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/posts\/220\/revisions"}],"predecessor-version":[{"id":364,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/posts\/220\/revisions\/364"}],"wp:attachment":[{"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/media?parent=220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/categories?post=220"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/tags?post=220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}