Skip to content

Commit 6ef30ad

Browse files
committed
LDEV-4956 setAdminPassword and adminPassword
https://luceeserver.atlassian.net/browse/LDEV-4956
1 parent cba5040 commit 6ef30ad

File tree

2 files changed

+55
-39
lines changed

2 files changed

+55
-39
lines changed

build-run-cfml.xml

Lines changed: 48 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project default="all" basedir="." name="run-cfml">
33
<macrodef name="echots">
4-
<attribute name="message"/>
4+
<attribute name="message" />
55
<sequential>
66
<local name="timestamp" />
77
<tstamp>
@@ -11,43 +11,46 @@
1111
</sequential>
1212
</macrodef>
1313
<target name="all">
14-
<echots message="Lucee Starting"/>
14+
<echots message="Lucee Starting" />
1515
<script language="CFML">
1616
<![CDATA[
1717
systemOutput( "---------- #DateTimeFormat(now(),'yyyy-mm-dd HH:nn:ss')# - Lucee Started ----------", true);
1818
systemOutput( "#server.lucee.version#", true );
1919
20-
request.adminPassword="admin";
20+
param name="adminPassword" default="admin";
21+
request.adminPassword = adminPassword;
2122
request.errorThrown = false;
2223
2324
try {
25+
param name="setAdminPassword" default="true";
26+
if ( setAdminPassword ) {
27+
28+
// set a password for the admin
29+
try {
30+
admin
31+
action="updatePassword"
32+
type="web"
33+
oldPassword=""
34+
newPassword="#request.adminPassword#";
35+
systemOutput( "Set Web admin password", true );
36+
}
37+
catch(e){
38+
systemOutput( e.message, true ); // may exist from previous execution
39+
}
2440
25-
// set a password for the admin
26-
try {
27-
admin
28-
action="updatePassword"
29-
type="web"
30-
oldPassword=""
31-
newPassword="#request.adminPassword#";
32-
systemOutput( "Set Web admin password", true );
33-
}
34-
catch(e){
35-
systemOutput( e.message, true ); // may exist from previous execution
36-
}
37-
38-
try {
39-
admin
40-
action="updatePassword"
41-
type="server"
42-
oldPassword=""
43-
newPassword="#request.adminPassword#";
44-
systemOutput( "Set Server admin password", true );
45-
}
46-
catch(e){
47-
systemOutput( e.message, true ); // may exist from previous execution
41+
try {
42+
admin
43+
action="updatePassword"
44+
type="server"
45+
oldPassword=""
46+
newPassword="#request.adminPassword#";
47+
systemOutput( "Set Server admin password", true );
48+
}
49+
catch(e){
50+
systemOutput( e.message, true ); // may exist from previous execution
51+
}
4852
}
4953
50-
5154
admin
5255
action="updateMapping"
5356
type="web"
@@ -59,18 +62,24 @@
5962
primary="physical"
6063
trusted="no";
6164
62-
admin
63-
action="getMappings"
64-
type="web"
65-
password="#request.adminPassword#"
66-
returnVariable="mappings";
67-
6865
systemOutput( "-------------- Mappings --------------", true );
69-
loop query="mappings" {
70-
systemOutput("#mappings.virtual# #chr( 9 )# #mappings.strPhysical# "
71-
& ( len( mappings.strArchive ) ? "[#mappings.strArchive#] " : "" )
72-
& ( len( mappings.inspect ) ? "(#mappings.inspect#)" : ""), true );
66+
try {
67+
admin
68+
action="getMappings"
69+
type="web"
70+
password="#request.adminPassword#"
71+
returnVariable="mappings";
72+
73+
loop query="mappings" {
74+
systemOutput("#mappings.virtual# #chr( 9 )# #mappings.strPhysical# "
75+
& ( len( mappings.strArchive ) ? "[#mappings.strArchive#] " : "" )
76+
& ( len( mappings.inspect ) ? "(#mappings.inspect#)" : ""), true );
77+
}
78+
79+
} catch( e ){
80+
systemOutput( e.message, true );
7381
}
82+
systemOutput( "ExpandPath( '/' ) #chr(9)# #ExpandPath( '/' )#" , true );
7483
7584
param name="extensionDir" default="";
7685
if ( len( extensionDir) ){
@@ -195,6 +204,6 @@
195204
}
196205
]]>
197206
</script>
198-
<echots message="Lucee Stopping"/>
207+
<echots message="Lucee Stopping" />
199208
</target>
200-
</project>
209+
</project>

build.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
<property name="preCleanup" value="true"/>
2525
<!-- delete the Lucee working dir afterwards -->
2626
<property name="postCleanup" value="true"/>
27+
<property name="setAdminPassword" value="true"/>
28+
<property name="adminPassword" value="admin"/>
2729

2830
<!-- scripts can be run as an include, or via internalRequest (default) which picks up any Application.cfc -->
2931
<property name="executeScriptByInclude" value=""/>
@@ -89,6 +91,8 @@
8991
<echo message="executeScriptByInclude: ${executeScriptByInclude}" />
9092
<echo message="luceeCFconfig: ${luceeCFconfig}" />
9193
<echo message="javaDebugger: ${debugger}" />
94+
<echo message="setAdminPassword: ${setAdminPassword}" />
95+
<echo message="adminPassword: ${adminPassword}" />
9296

9397
<echo message="" />
9498
<!-- execute CFML testcases -->
@@ -121,6 +125,9 @@
121125
<jvmarg value="-Dlucee.extensions=${extensions}"/>
122126
<jvmarg value="-Dlucee.mapping.first=true"/>
123127
<jvmarg value="-Dcompile=${compile}"/>
128+
<jvmarg value="-DsetAdminPassword=${setAdminPassword}"/>
129+
<jvmarg value="-DadminPassword=${adminPassword}"/>
130+
124131
<!--
125132
<jvmarg value="-Dlucee.cli.printExceptions=true"/>
126133
-->

0 commit comments

Comments
 (0)