X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/ebb51f80568cc35cf3cd2f99a31a28f72526798d..0e0442b0650ceb74175905578054db8877b1bbbd:/src/main-portal.sml diff --git a/src/main-portal.sml b/src/main-portal.sml new file mode 100644 index 0000000..93f7612 --- /dev/null +++ b/src/main-portal.sml @@ -0,0 +1,44 @@ +(* HCoop Domtool (http://hcoop.sourceforge.net/) + * Copyright (c) 2014, Clinton Ebadi + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + *) + +(* Portal helper utility. *) + +(* Duplicated from main-config.sml, should be put into a common module + and all domtool commands should return proper exit codes instead of + always succeeding *) + +fun println x = (print x; print "\n") +fun printerr x = (TextIO.output (TextIO.stdErr, x); TextIO.flushOut TextIO.stdErr) +fun die reason = (printerr reason; printerr "\n"; OS.Process.exit OS.Process.failure) + +val _ = + case CommandLine.arguments () of + ["vmailpasswd", domain, user] => + (case Client.getpass () of + Client.Passwd oldpasswd => + (case Client.getpass () of + Client.Passwd newpasswd => + Main.requestPortalPasswdMailbox {domain = domain, + user = user, + oldpasswd = oldpasswd, + newpasswd = newpasswd} + | Client.Aborted => die "Aborted" + | Client.Error => die "New passwords did not match") + | _ => die "Error entering old password") + | _ => die "Invalid command-line arguments" +