Mercurial > avadmin > converted
view passwd.py @ 508:64f8666690d8
README update
(Logical change 1.149)
author | optonline.net!jeffpc |
---|---|
date | Fri, 16 Jan 2004 02:53:48 +0000 |
parents | e7e6ead55338 |
children | 152ab8c93126 |
line wrap: on
line source
#!/usr/bin/python #/* # * AV Admin - Helps to manage an AV department # * # * Copyright (C) 2003, 2004 Josef "Jeff" Sipek # * # * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # * # * $Id$ # */ import av_conn conn = av_conn.Conn() conn.html.content("text/html") conn.html.header("Change Password") conn.html.body.init(template="passwd",conn=conn) buff = "" if (conn.getparam("change")=="yes"): opass = conn.getparam("oldpass") npass1 = conn.getparam("newpass1") npass2 = conn.getparam("newpass2") error = 0 if (not opass): error = "<br><div class=\"error\">Sorry, you need to enter the old password</div><br>" if (((not npass1) or (not npass2)) and (not error)): error = "<br><div class=\"error\">Sorry, you need to fill out both of the new password fields</div><br>" if ((not conn.validatestring(opass)) and (not error)): error = "<br><div class=\"error\">Sorry, the old password contains invalid character(s)</div><br>" if (((not conn.validatestring(npass1)) or (not conn.validatestring(npass2))) and not error): error = "<br><div class=\"error\">Sorry, one of the new password fields contains invalid character(s)</div><br>" if ((npass1!=npass2) and (not error)): # FIXME: new passwords don't match error = "<br><div class=\"error\">Sorry, the new password fields do not match</div><br>" if ((not conn.user.checkpass(opass)) and (not error)): # FIXME: log this event error = "<br><div class=\"error\">Sorry, the old password is incorrect</div><br>" if (not error): if (conn.user.changepass(npass1)): buff += conn.html.subheading("Success!") + "Your password has been changed." else: buff += "<br><div class=\"error\">Sorry, a fatal error occured.</div><br>" else: buff += error conn.tproc.set("passwderror",buff+"<br />") conn.html.footer() print conn.flush()