From 9148af96a92a1c9166f75b9e96cd9e424137a5cd Mon Sep 17 00:00:00 2001 From: mdipierro Date: Mon, 30 Jul 2012 22:07:08 -0500 Subject: [PATCH] removed some possible tckets in auth --- VERSION | 2 +- gluon/contrib/markmin/markmin2html.py | 2 +- gluon/tools.py | 13 +++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index fbcfe843..a14ce75d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.00.0 (2012-07-30 20:23:00) dev +Version 2.00.0 (2012-07-30 22:07:05) dev diff --git a/gluon/contrib/markmin/markmin2html.py b/gluon/contrib/markmin/markmin2html.py index 893c4950..fc3e5d7b 100755 --- a/gluon/contrib/markmin/markmin2html.py +++ b/gluon/contrib/markmin/markmin2html.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/bin/env python # -*- coding: utf-8 -*- # created by Massimo Di Pierro # recreated by Vladyslav Kozlovskyy diff --git a/gluon/tools.py b/gluon/tools.py index 94501c82..36ac46ad 100644 --- a/gluon/tools.py +++ b/gluon/tools.py @@ -49,6 +49,15 @@ logger = logging.getLogger("web2py") DEFAULT = lambda: None +def getarg(position,default=None): + args = current.request.args + if position<0 and len(args)>=-position: + return args[position] + elif position>=0 and len(args)>position: + return args[position] + else: + return default + def callback(actions,form,tablename=None): if actions: if tablename and isinstance(actions,dict): @@ -2122,7 +2131,7 @@ class Auth(object): """ - key = current.request.args[-1] + key = getarg(-1) table_user = self.settings.table_user user = self.db(table_user.registration_key == key).select().first() if not user: @@ -2332,7 +2341,7 @@ class Auth(object): if next is DEFAULT: next = self.next or self.settings.reset_password_next try: - key = request.vars.key or request.args[-1] + key = request.vars.key or getarg(-1) t0 = int(key.split('-')[0]) if time.time()-t0 > 60*60*24: raise Exception user = self.db(table_user.reset_password_key == key).select().first()