Fix #1016 - Covert the timestamp from seconds to datetime object
This commit is contained in:
parent
aa68730237
commit
4fc1671d84
@ -13,6 +13,7 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
import datetime
|
||||||
|
|
||||||
from oauthlib.common import Request
|
from oauthlib.common import Request
|
||||||
from oauthlib.oauth1 import RequestValidator
|
from oauthlib.oauth1 import RequestValidator
|
||||||
@ -64,6 +65,14 @@ class GMGRequestValidator(RequestValidator):
|
|||||||
def validate_timestamp_and_nonce(self, client_key, timestamp,
|
def validate_timestamp_and_nonce(self, client_key, timestamp,
|
||||||
nonce, request, request_token=None,
|
nonce, request, request_token=None,
|
||||||
access_token=None):
|
access_token=None):
|
||||||
|
# RFC5849 (OAuth 1.0) section 3.3 says the timestamp is going
|
||||||
|
# to be seconds after the epoch, we need to convert for postgres
|
||||||
|
try:
|
||||||
|
timestamp = datetime.datetime.fromtimestamp(float(timestamp))
|
||||||
|
except ValueError:
|
||||||
|
# Well, the client must have passed up something ridiculous
|
||||||
|
return False
|
||||||
|
|
||||||
nc = NonceTimestamp.query.filter_by(timestamp=timestamp, nonce=nonce)
|
nc = NonceTimestamp.query.filter_by(timestamp=timestamp, nonce=nonce)
|
||||||
nc = nc.first()
|
nc = nc.first()
|
||||||
if nc is None:
|
if nc is None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user