o c@sddlmZddlmZddlmZmZddlmZddlmZddl m Z ddl m Z ddl Z ddlZddlmZddlZddlZd d Ze d d ZdS) )render)User UserToken)Max)timezone) HttpResponse) csrf_exemptN) randrangec Cstt}t}t}|jdd}tjj|dj}tjj|dj }t |||||d}| d|i}t |d|S)Nusername)r )id)uuid created_at updated_atuser_idr Z usertokenzusertoken_detail.html) r uuid1rnowGETgetrobjectsr r rsaver) requestZ token_uuidZtoken_created_atZtoken_updated_atZ arg_usernamer user_usernameZ usertoken_objcontextr7/Users/birayaha/craft-auth-disco/auth_app/auth_users.pygetokens rcCsh|jd}td||d}|dd}|ddd}t||dd}t|t|S)Nzutf-8zBody decoded utf-8:%s&r=-)bodydecodeprintsplitr)rZ body_unicoder!r Z fulltokenZ tokenchunkrrrvalidate_identitys   r%)django.shortcutsrZauth_app.modelsrrdjango.db.modelsr django.utilsr django.httprdjango.views.decorators.csrfrr jsonrandomr stringrr%rrrrs