def POST(self): if web.ctx.session.get('loggedin',0) == 1: userid = web.ctx.session.get('userid',-1) superuser = is_superuser(userid) username = get_username(userid) request = web.input() old_password = request.old_password new_password = request.new_password new_password_confirm = request.new_password_confirm if new_password != new_password_confirm: msg = "Password doesn't match the confirmation" error = True elif len(new_password) < 6: msg = "Password too short" error = True else: user = User(username=username, password=old_password) if user.is_authenticated() == True: user.set_passwd(new_password) user.save(update=True) msg = "PassWord Changed" error = False else: msg = "Old PassWord Error" error = True ctx = Storage(locals()) return render_fluid.change_passwd(ctx)
def POST(self): web.header('Content-type','text/plain') if web.ctx.session.get('loggedin',0) == 1: userid = web.ctx.session.get('userid',-1) superuser = is_superuser(userid) username = get_username(userid) request = web.input() old_password = request.old_password user = User(username=username, password=old_password) if user.is_authenticated() == True: return 'ok' else: return 'fail'