aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/youtube.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2018-12-26 02:21:20 -0800
committerJames Taylor <user234683@users.noreply.github.com>2018-12-26 02:21:20 -0800
commitb321b5fc6484c38d861530e6b89405b062e32459 (patch)
tree17857ea71377604b887e1242ff596a6817c165d8 /youtube/youtube.py
parentb4aa7cecbc2433a9a734c1896bf24ed57b141884 (diff)
downloadyt-local-b321b5fc6484c38d861530e6b89405b062e32459.tar.lz
yt-local-b321b5fc6484c38d861530e6b89405b062e32459.tar.xz
yt-local-b321b5fc6484c38d861530e6b89405b062e32459.zip
Server-side http logic for adding account
Diffstat (limited to 'youtube/youtube.py')
-rw-r--r--youtube/youtube.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/youtube/youtube.py b/youtube/youtube.py
index a08d7b5..418e707 100644
--- a/youtube/youtube.py
+++ b/youtube/youtube.py
@@ -116,6 +116,19 @@ def youtube(env, start_response):
start_response('303 See Other', (('Location', common.URL_ORIGIN + '/comments?ctoken=' + comments.make_comment_ctoken(video_id, sort=1)),) )
return ''
+ elif path == "/login":
+ if 'save' in fields and fields['save'][0] == "on":
+ save_account = True
+ else:
+ save_account = False
+
+ if accounts.add_account(fields['username'][0], fields['password'][0], save_account ):
+ start_response('200 OK', () )
+ return b'Account successfully added'
+ else:
+ start_response('200 OK', () )
+ return b'Failed to add account'
+
else:
start_response('404 Not Found', ())
return b'404 Not Found'