<s> import time <EOL> import webapp2_extras . appengine . auth . models <EOL> from google . appengine . ext import ndb <EOL> from webapp2_extras import security <EOL> class User ( webapp2_extras . appengine . auth . models . User ) : <EOL> def set_password ( self , raw_password ) : <EOL> """<STR_LIT>""" <EOL> self . password = security . generate_password_hash ( raw_password , length = <NUM_LIT:12> ) <EOL> @ classmethod <EOL> def get_by_auth_token ( cls , user_id , token , subject = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> token_key = cls . token_model . get_key ( user_id , subject , token ) <EOL> user_key = ndb . Key ( cls , user_id ) <EOL> valid_token , user = ndb . get_multi ( [ token_key , user_key ] ) <EOL> if valid_token and user : <EOL> timestamp = int ( time . mktime ( valid_token . created . timetuple ( ) ) ) <EOL> return user , timestamp <EOL> return None , None </s>
