From 80e4a858837fd36276546c0b463c2b040cde4d23 Mon Sep 17 00:00:00 2001 From: nathaniel smith Date: Mon, 21 Nov 2016 21:14:47 -0800 Subject: [PATCH] more form stuff; it's working --- ttadmin/users/models.py | 8 ++ ttadmin/users/templates/ttadmin/signup.html | 108 +++++++++++++++++--- ttadmin/users/views.py | 7 +- 3 files changed, 105 insertions(+), 18 deletions(-) diff --git a/ttadmin/users/models.py b/ttadmin/users/models.py index b3dc292..9d45224 100644 --- a/ttadmin/users/models.py +++ b/ttadmin/users/models.py @@ -3,6 +3,10 @@ from django.dispatch import receiver from django.contrib.auth.models import User from django.db.models import TextField, BooleanField, CharField +SSH_TYPE_CHOICES = ( + ('ssh-rsa', 'ssh-rsa',), + ('ssh-dss', 'ssh-dss',), +) class Townie(User): """Both an almost normal Django User as well as an abstraction over a @@ -11,6 +15,10 @@ class Townie(User): shell = CharField(max_length=50, default="/bin/bash") reviewed = BooleanField(default=False) displayname = CharField(max_length=100, blank=False, null=False) + pubkey_type = CharField(max_length=15, + blank=False, + null=False, + choices=SSH_TYPE_CHOICES) @property def home_path(self): diff --git a/ttadmin/users/templates/ttadmin/signup.html b/ttadmin/users/templates/ttadmin/signup.html index 41f2e6b..574bcb0 100644 --- a/ttadmin/users/templates/ttadmin/signup.html +++ b/ttadmin/users/templates/ttadmin/signup.html @@ -2,6 +2,18 @@ tilde.town signup page +

sign up for a tilde.town account

@@ -11,23 +23,85 @@
{% csrf_token %} - - - - - + + + + + + + + + + + + + + + + + + + + + +
+

+ username +

+

+ Must be lowercase and start with letters. +

+
+ +
+

+ email +

+

+ used to notify you about your account. not used for + any other reason and never shared. +

+
+ +
+

+ display name +

+

+ an optional long-form name to go by. absolutely no + obligation to provide your "real" name. will appear + in various places. +

+
+ +
+

+ ssh public key +

+

+ your ssh public key. if ssh is new + to you, check out + our guide for help. Provide just the guts + of the key; it will most likely start with + AAAAB3NzaC1iyc +

+
+ +
+

+ ssh public key type +

+

+ You can leave this alone unless you know that you need to change it. +

+
+ +
diff --git a/ttadmin/users/views.py b/ttadmin/users/views.py index 081eabf..7869981 100644 --- a/ttadmin/users/views.py +++ b/ttadmin/users/views.py @@ -1,7 +1,7 @@ from django.http import HttpResponse from django.views.generic import TemplateView -from .models import Townie +from .models import Townie, SSH_TYPE_CHOICES # TODO validation functions for final request validation and live js validation # I refuse to duplicate the logic for validation on the front-end and am going @@ -10,6 +10,11 @@ from .models import Townie class UserSignupView(TemplateView): template_name = 'ttadmin/signup.html' + def get_context_data(self): + ctx = super().get_context_data() + ctx['ssh_type_choices'] = SSH_TYPE_CHOICES + return ctx + def post(self, request): print(request.POST) # TODO validate