<s> from tapiriik . sync import Sync <EOL> from django . http import HttpResponse <EOL> from django . views . decorators . http import require_POST <EOL> from django . shortcuts import redirect <EOL> from tapiriik . auth import User <EOL> import json <EOL> import dateutil . parser <EOL> @ require_POST <EOL> def account_setemail ( req ) : <EOL> if not req . user : <EOL> return HttpResponse ( status = <NUM_LIT> ) <EOL> User . SetEmail ( req . user , req . POST [ "<STR_LIT:email>" ] ) <EOL> return redirect ( "<STR_LIT>" ) <EOL> @ require_POST <EOL> def account_settimezone ( req ) : <EOL> if not req . user : <EOL> return HttpResponse ( status = <NUM_LIT> ) <EOL> User . SetTimezone ( req . user , req . POST [ "<STR_LIT>" ] ) <EOL> return HttpResponse ( ) <EOL> @ require_POST <EOL> def account_setconfig ( req ) : <EOL> if not req . user : <EOL> return HttpResponse ( status = <NUM_LIT> ) <EOL> data = json . loads ( req . body . decode ( "<STR_LIT:utf-8>" ) ) <EOL> if data [ "<STR_LIT>" ] and len ( data [ "<STR_LIT>" ] ) : <EOL> data [ "<STR_LIT>" ] = dateutil . parser . parse ( data [ "<STR_LIT>" ] ) <EOL> User . SetConfiguration ( req . user , data ) <EOL> Sync . SetNextSyncIsExhaustive ( req . user , True ) <EOL> return HttpResponse ( ) </s>
