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 c.timezones = all_timezones
return render(u'/account/index.mako') 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): def register(self):
c.page_title = u'Register' c.page_title = u'Register'
return render(u'/account/register.mako') return render(u'/account/register.mako')
@jsvalidate(u'register-form') @jsvalidate(u'account-register')
def register_jsschema(self): def register_jsschema(self):
return { return {
u'register-email': JSEmail(required=True, message=u'You haven\'t typed in an e-mail address.'), u'register-email': JSEmail(required=True,
u'register-password': JSString(required=True, message=u'You haven\'t typed in a password.'), message=u'You haven\'t typed in an e-mail address.'),
u'register-confirm': JSString(required=True, equalTo=u'#password', message=u'Your passwords don\'t match.') 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): def register_schema(self):
return { return {
'register-email': Email(not_empty=True, messages={'empty': u'You haven\'t typed in an e-mail address.'}), 'register-email': Email(not_empty=True,
'register-password': UnicodeString(not_empty=True, messages={'empty': u'You haven\'t typed in a password.'}), messages={'empty': u'You haven\'t typed in an e-mail address.'}),
'confirm-password': [FieldsMatch('register-password', 'register-confirm', messages={'invalid': u'Your passwords don\'t match.'})] '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): 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'first_name', Unicode(100), default=u''),
Column(u'last_name', Unicode(100), default=u''), Column(u'last_name', Unicode(100), default=u''),
Column(u'homepage', Unicode(200), 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) Column(u'activation_key', Unicode(40), default=None)
) )

View File

@ -393,6 +393,19 @@ fieldset {
color: #fff; 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 { .form-text {
font-size: 1.5em; font-size: 1.5em;
padding: 4px 6px; padding: 4px 6px;

View File

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