Start of account management.

This commit is contained in:
Raoul Snyman 2010-03-08 14:50:18 +02:00
parent c11de84241
commit ea875ca816
4 changed files with 38 additions and 8 deletions

View File

@ -46,23 +46,39 @@ class AccountController(BaseController):
c.timezones = all_timezones
return render(u'/account/index.mako')
@jsvalidate(u'account-account')
def index_jsschema(self):
return {
u'account-nick': JSString(required=True,
message=u'You need to type in a nick.'),
u'account-email': JSEmail(required=True,
message=u'You need to supply a valid e-mail address.')
}
def register(self):
c.page_title = u'Register'
return render(u'/account/register.mako')
@jsvalidate(u'register-form')
@jsvalidate(u'account-register')
def register_jsschema(self):
return {
u'register-email': JSEmail(required=True, message=u'You haven\'t typed in an e-mail address.'),
u'register-password': JSString(required=True, message=u'You haven\'t typed in a password.'),
u'register-confirm': JSString(required=True, equalTo=u'#password', message=u'Your passwords don\'t match.')
u'register-email': JSEmail(required=True,
message=u'You haven\'t typed in an e-mail address.'),
u'register-password': JSString(required=True,
message=u'You haven\'t typed in a password.'),
u'register-confirm': JSString(required=True, equalTo=u'#password',
message=u'Your passwords don\'t match.')
}
def register_schema(self):
return {
'register-email': Email(not_empty=True, messages={'empty': u'You haven\'t typed in an e-mail address.'}),
'register-password': UnicodeString(not_empty=True, messages={'empty': u'You haven\'t typed in a password.'}),
'confirm-password': [FieldsMatch('register-password', 'register-confirm', messages={'invalid': u'Your passwords don\'t match.'})]
'register-email': Email(not_empty=True,
messages={'empty': u'You haven\'t typed in an e-mail address.'}),
'register-password': UnicodeString(not_empty=True,
messages={'empty': u'You haven\'t typed in a password.'}),
'confirm-password': [
FieldsMatch('register-password', 'register-confirm',
messages={'invalid': u'Your passwords don\'t match.'})]
}
def register_POST(self):

View File

@ -103,6 +103,7 @@ users_table = Table(u'users', metadata,
Column(u'first_name', Unicode(100), default=u''),
Column(u'last_name', Unicode(100), default=u''),
Column(u'homepage', Unicode(200), default=u''),
Column(u'timezone', Unicode(200), default=u'UTC'),
Column(u'activation_key', Unicode(40), default=None)
)

View File

@ -393,6 +393,19 @@ fieldset {
color: #fff;
}
.form-select {
color: #fff;
background-color: #1f1f1f;
font-size: 1.2em;
border: 1px solid #454545;
padding: 3px 5px;
}
.form-select option {
background-color: #1f1f1f;
color: #fff;
}
.form-text {
font-size: 1.5em;
padding: 4px 6px;

View File

@ -30,7 +30,7 @@
<label for="account-timezone">Timezone:</label>
<select name="account-timezone" id="account-timezone" class="form-select">
% for timezone in c.timezones:
<option>${timezone.zone}</option>
<option value="${timezone}">${timezone}</option>
% endfor
</select>
</div>