 <cfset plugins=array()>
 <cfif StructKeyExists(session,"password"&request.adminType)>
 	<cftry>
-    <cfadmin
-	    action="getPluginDirectory"
-	    type="#request.adminType#"
-	    password="#session["password"&request.adminType]#"
-	    returnVariable="pluginDir">
+	<cfadmin
+		action="getPluginDirectory"
+		type="#request.adminType#"
+		password="#session["password"&request.adminType]#"
+		returnVariable="pluginDir">
 	<cfset mappings['/lucee_plugin_directory/']=pluginDir>
 	<cfapplication action="update" mappings="#mappings#">
 
-    <cfset hasPlugin=false>
-    <cfloop array="#navigation#" index="el">
-    	<cfif el.action EQ "plugin"><cfset hasPlugin=true></cfif>
-    </cfloop>
+	<cfset hasPlugin=false>
+	<cfloop array="#navigation#" index="el">
+		<cfif el.action EQ "plugin"><cfset hasPlugin=true></cfif>
+	</cfloop>
 
 	<cfif not hasPlugin or (structKeyExists(session,"alwaysNew") and session.alwaysNew)>
-    	<cfif not hasPlugin>
-        <cfset plugin=struct(
-            label:"Plugins",
-            children:plugins,
-            action:"plugin"
-        )>
-    	<cfset navigation[arrayLen(navigation)+1]=plugin>
-        </cfif>
-
-        <cfset sctNav={}>
-        <cfloop array="#navigation#" index="item">
-        	<cfset sctNav[item.action]=item>
-        </cfloop>
-
-        <cfdirectory directory="#plugindir#" action="list" name="plugindirs" recurse="no">
-        <cfloop query="plugindirs">
-            <cfif plugindirs.type EQ "dir">
-                <cfset _lang=loadPluginLanguage(pluginDir,plugindirs.name)>
-                <cfif isNull(_lang.__group)>
+		<cfif not hasPlugin>
+		<cfset plugin=struct(
+			label:"Plugins",
+			children:plugins,
+			action:"plugin"
+		)>
+		<cfset navigation[arrayLen(navigation)+1]=plugin>
+		</cfif>
+
+		<cfset sctNav={}>
+		<cfloop array="#navigation#" index="item">
+			<cfset sctNav[item.action]=item>
+		</cfloop>
+
+		<cfdirectory directory="#plugindir#" action="list" name="plugindirs" recurse="no">
+		<cfloop query="plugindirs">
+			<cfif plugindirs.type EQ "dir">
+				<cfset _lang=loadPluginLanguage(pluginDir,plugindirs.name)>
+				<cfif isNull(_lang.__group)>
 					<cfcontinue>
 				</cfif>
-                <cfset _act=_lang.__action>
+				<cfset _act=_lang.__action>
 				<cfset _group=_lang.__group>
 				<cfset _pos=_lang.__position>
 				<cfset StructDelete(_lang,"__action",false)>
 
 				<cfset application.pluginLanguage[session.lucee_admin_lang][plugindirs.name]=_lang>
 
-                <cfset item=struct(
-                    label:_lang.title,
-                    action:plugindirs.name,
-                    _action:'plugin&plugin='&plugindirs.name
-                )>
-
-                <cfif not StructKeyExists(sctNav,_act)>
-                	<cfset sctNav[_act]=struct(
+				<cfset item=struct(
+					label:_lang.title,
+					action:plugindirs.name,
+					_action:'plugin&plugin='&plugindirs.name
+				)>
+
+				<cfif not StructKeyExists(sctNav,_act)>
+					<cfset sctNav[_act]=struct(
 						label:_group,
 						children:[],
 						action:_act
 					)>
-                    <cfif _pos GT 0 and _pos LTE arrayLen(navigation)>
-                    	<cfscript>
+					<cfif _pos GT 0 and _pos LTE arrayLen(navigation)>
+						<cfscript>
 						for(i=arrayLen(navigation)+1;i>_pos;i--){
 							navigation[i]=navigation[i-1];
 						}
-                        navigation[_pos]=sctNav[_act];
+						navigation[_pos]=sctNav[_act];
 						</cfscript>
-                    <cfelse>
-                    	<cfset navigation[arrayLen(navigation)+1]=sctNav[_act]>
-                    </cfif>
-
-                </cfif>
-
-                <cfset children=sctNav[_act].children>
-                <cfset isUpdate=false>
-                <cfloop from="1" to="#arrayLen(children)#" index="i">
-                	<cfif children[i].action EQ item.action>
-                    	<cfset children[i]=item>
-                        <cfset isUpdate=true>
-            </cfif>
-        </cfloop>
-                <cfif not isUpdate>
-                	<cfset children[arrayLen(children)+1]=item>
-    </cfif>
-
-</cfif>
-        </cfloop>
-    </cfif>
-    	<cfcatch><cfrethrow></cfcatch>
-    </cftry>
+					<cfelse>
+						<cfset navigation[arrayLen(navigation)+1]=sctNav[_act]>
+					</cfif>
+
+				</cfif>
+
+				<cfset children=sctNav[_act].children>
+				<cfset isUpdate=false>
+				<cfloop from="1" to="#arrayLen(children)#" index="i">
+					<cfif children[i].action EQ item.action>
+						<cfset children[i]=item>
+						<cfset isUpdate=true>
+			</cfif>
+		</cfloop>
+				<cfif not isUpdate>
+					<cfset children[arrayLen(children)+1]=item>
+	</cfif>
+
+</cfif>
+		</cfloop>
+	</cfif>
+		<cfcatch><cfrethrow></cfcatch>
+	</cftry>
 
 </cfif>
 <cfsavecontent variable="arrow"><img src="resources/img/arrow.gif.cfm" width="4" height="7" /></cfsavecontent>

	strNav ='<ul id="menu">'& strNav&'</ul>' ;

/* moved to title in content area
   if (favoriteLis neq "")
   {
	   strNav = '<li id="favorites"><a href="##">Favorites</a><ul>' & favoriteLis & "</ul></li>" & strNav;
   }
   */

	function toBool(sct,key) {
		if(not StructKeyExists(arguments.sct,arguments.key)) return false;

<!--- Form --->
<cfif StructKeyExists(form,"login_password"&request.adminType)>
	<cfadmin
		action="getLoginSettings"
		type="#request.adminType#"
		returnVariable="loginSettings">

	<cfset loginPause=loginSettings.delay>



	<cfif loginPause and StructKeyExists(application,'lastTryToLogin') and IsDate(application.lastTryToLogin) and DateDiff("s",application.lastTryToLogin,now()) LT loginPause>
		<cfset login_error="Login disabled until #lsDateFormat(DateAdd("s",loginPause,application.lastTryToLogin))# #lsTimeFormat(DateAdd("s",loginPause,application.lastTryToLogin),'hh:mm:ss')#">
	<cfelse>
		<cfset application.lastTryToLogin=now()>
		<cfparam name="form.captcha" default="">

		<cfif loginSettings.captcha and structKeyExists(session,"cap") and compare(form.captcha,session.cap) NEQ 0>
			<cfset login_error="Invalid security code (captcha) definition">

		<cfelse>
			<cfadmin
				action="hashPassword"
				type="#request.adminType#"
				pw="#form["login_password"&ad]#"
				returnVariable="hashedPassword">
			<cfset session["password"&request.adminType]=hashedPassword>
			<cfset session.lucee_admin_lang=form.lang>
			<!--- Thread operation for update provider --->
			<cfcookie expires="NEVER" name="lucee_admin_lang" value="#session.lucee_admin_lang#">
			<cfif form.rememberMe NEQ "s">
				<cfcookie
					expires="#DateAdd(form.rememberMe,1,now())#"
					name="lucee_admin_pw_#server.lucee.version#_#ad#"
					value="#hashedPassword#">
			<cfelse>
				<cfcookie expires="Now" name="lucee_admin_pw_#server.lucee.version#_#ad#" value="">
			</cfif>
			<cfif isDefined("cookie.lucee_admin_lastpage") and cookie.lucee_admin_lastpage neq "logout">
				<cfset url.action = cookie.lucee_admin_lastpage>
			</cfif>
		</cfif>
	</cfif>
</cfif>

<!--- Process New Password !--->
<cfif StructKeyExists(form,"new_password") and StructKeyExists(form,"new_password_re")>
	<cfif len(form.new_password) LT 6>
		<cfset login_error="password is too short, it must have at least 6 chars">
