webbuild: support for admin user and access from localhost; support enter key in user and password input
This commit is contained in:
parent
4ff95a4a86
commit
2b8d183d22
1
Makefile
1
Makefile
@ -99,6 +99,7 @@ install-data:
|
||||
@$(INSTALL_DATA) etc/autodist/distdb.d/* $(DESTDIR)$(configdir)/distdb.d/
|
||||
@$(INSTALL_DATA) etc/sudoers.d/autoport $(DESTDIR)$(sysconfdir)/sudoers.d/autoport
|
||||
@$(INSTALL_DATA) webbuild/webbuild-sudoers $(DESTDIR)$(sysconfdir)/sudoers.d/webbuild
|
||||
@$(INSTALL_DATA) webbuild/webbuild-admin $(DESTDIR)$(localstatedir)/webbuild/users/admin.conf
|
||||
@$(INSTALL_SCRIPT) etc/sysconfig/autoport $(DESTDIR)$(sysconfdir)/sysconfig/autoport
|
||||
@$(INSTALL_SCRIPT) etc/cron.hourly/60-autodist-update $(DESTDIR)$(sysconfdir)/cron.hourly/
|
||||
@$(INSTALL_SCRIPT) etc/cron.hourly/65-autoport-native $(DESTDIR)$(sysconfdir)/cron.hourly/
|
||||
|
@ -209,7 +209,7 @@ function ajax_getvalues(request,confirm) {
|
||||
<tr><td>
|
||||
<span class=webbuild>
|
||||
<div id=container style="position:relative;width:894px;height:auto;top:0;left:0;">
|
||||
<form id=webbuildform name=webbuild method=post>
|
||||
<form id=webbuildform name=webbuild method=post action="javascript:">
|
||||
|
||||
<span id="searchbox"></span>
|
||||
|
||||
|
6
webbuild/webbuild-admin
Normal file
6
webbuild/webbuild-admin
Normal file
@ -0,0 +1,6 @@
|
||||
USER_ENABLED=1
|
||||
USER_ADMIN=1
|
||||
USER_CANINSTALL=1
|
||||
USER_CANMAINTAIN=1
|
||||
USER_ALLENVIRONMENTS=1
|
||||
USER_ALLREPOSITORIES=1
|
@ -29,6 +29,9 @@ USER_ADMIN=
|
||||
USER_CANMAINTAIN=
|
||||
USER_CANSENDMESSAGES=
|
||||
USER=${USER/.*\/}
|
||||
if [ "$REMOTE_ADDR" = "127.0.0.1" -a "$USER" = "" ]; then
|
||||
USER=admin
|
||||
fi
|
||||
if [ "$USER" ]; then
|
||||
if [ -r "$WEBBUILD_STATEDIR/users/$USER.conf" ]; then
|
||||
. $WEBBUILD_STATEDIR/users/$USER.conf
|
||||
@ -36,7 +39,7 @@ if [ "$USER" ]; then
|
||||
if [ "$USER_ENABLED" ]; then
|
||||
USER_ENABLED=
|
||||
if [ "$SECRET" = "$USER_SECRET" ]; then
|
||||
USER_ENABLED=1
|
||||
[ "$REMOTE_ADDR" = "127.0.0.1" -o "$USER_SECRET" ] && USER_ENABLED=1 || USER_ENABLED=
|
||||
elif [ "$REQUEST" = "password" ]; then
|
||||
if [ "$USER_SECRET" ]; then
|
||||
/usr/libexec/webbuild-checkpassword "$PASSWORD" "$USER_SECRET" 2>/dev/null
|
||||
@ -56,7 +59,10 @@ if [ "$USER" ]; then
|
||||
fi
|
||||
elif [ "$REQUEST" != "refresh" ]; then
|
||||
# no "$USER_SECRET" set; require password
|
||||
echo -n "<output><![CDATA[Please enter your password: <input type=password id=password>"
|
||||
echo -n "<output><![CDATA[Please enter your password: <input type=password id=password "
|
||||
echo -n "onkeypress=if(checkEnter(event))"
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "REQUEST=password&PASSWORD=\"+encodeURIComponent(getElementById('password').value));>"
|
||||
echo -n " <input type=button value=\"Submit\" onClick="
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "REQUEST=password&PASSWORD=\"+encodeURIComponent(getElementById('password').value));>"
|
||||
@ -74,7 +80,10 @@ if [ "$USER" ]; then
|
||||
fi
|
||||
fi
|
||||
elif [ "$REQUEST" != "refresh" ]; then
|
||||
echo -n "<output><![CDATA[Please enter your username: <input type=text id=username>"
|
||||
echo -n "<output><![CDATA[Please enter your username: <input type=text id=username "
|
||||
echo -n "onkeypress=if(checkEnter(event)){"
|
||||
echo -n "user=encodeURIComponent(getElementById('username').value);"
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED\");};>"
|
||||
echo -n " <input type=button value=\"Submit\" onClick="
|
||||
echo -n "user=encodeURIComponent(getElementById('username').value);"
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED\");>"
|
||||
|
Loading…
Reference in New Issue
Block a user