add addalias functionality

This commit is contained in:
2015-07-10 18:08:17 +03:00
parent ac4ec80edd
commit 47a47d6331
2 changed files with 41 additions and 1 deletions

View File

@@ -36,7 +36,7 @@ PASS=$(cat "$3")
## FUNCTIONS
function checkaction {
REGEX="^adduser$|^changepw$|^listusers$|^userdetail$|^deluser$|^sizeall$|^sizeuser$|^viewdata$"
REGEX="^adduser$|^changepw$|^listusers$|^userdetail$|^deluser$|^sizeall$|^sizeuser$|^viewdata$|^addalias$"
if [[ $1 =~ $REGEX ]]; then
echo "true"
else
@@ -212,6 +212,29 @@ if [ "$ACTION" == "adduser" ]; then
fi
fi # /adduser
# # # # #
# ADD ALIAS
# # # # #
if [ "$ACTION" == "addalias" ]; then
echo "Extracting details of Email account..."
echo
DEST=$PASS
if $(userexists "$USER"); then
echo "User \"$USER\" does already exist!"
exit 1
fi
if ! $(userexists "$DEST"); then
echo "Destination account \"$DEST\" does not exist!"
exit 1
fi
vaddalias $USER $DEST
fi # /addalias
# # # # #
# CHANGE PASSWORD
# # # # #

View File

@@ -43,6 +43,23 @@
<input type="hidden" name="sure" value="yes" />
</form>
</div> <!-- /hide -->
<!-- ADDALIAS - Add a new email redirection -->
<b class="switch"><span class="turn_on">&#187;</span><span class="turn_off">&#171;</span> Add an email redirection</b>
<div class="hide">
<p>This creates an alias email account. This account has no mailbox
but just redirects all mails to another account.</p>
<form action="submit.php" method="post">
<label>Alias name:</label>
<input name="user" title="Alias" />
<label>Destination account:</label>
<input name="pass" title="Destination" />
<br />
<button type="submit" name="action" value="addalias">Add alias</button>
<!-- Hidden confirmation box -->
<input type="hidden" name="sure" value="yes" />
</form>
</div> <!-- /hide -->
<!-- CHANGEPW - Change password of an email account -->
<b class="switch"><span class="turn_on">&#187;</span><span class="turn_off">&#171;</span> Change email password</b>