Show More
@@ -255,7 +255,7 b' def send_email(recipients, subject, body' | |||
|
255 | 255 | recipients = [email_config.get('email_to')] |
|
256 | 256 | |
|
257 | 257 | def str2bool(v): |
|
258 | return v.lower() in ["yes", "true", "t", "1"] | |
|
258 | return v.lower() in ["yes", "true", "t", "1"] if v else None | |
|
259 | 259 | |
|
260 | 260 | mail_from = email_config.get('app_email_from') |
|
261 | 261 | user = email_config.get('smtp_username') |
@@ -76,8 +76,34 b' def ValidUsername(edit, old_data):' | |||
|
76 | 76 | class ValidPassword(formencode.validators.FancyValidator): |
|
77 | 77 | |
|
78 | 78 | def to_python(self, value, state): |
|
79 | ||
|
79 | 80 | if value: |
|
80 | return get_crypt_password(value) | |
|
81 | ||
|
82 | if value.get('password'): | |
|
83 | try: | |
|
84 | value['password'] = get_crypt_password(value['password']) | |
|
85 | except UnicodeEncodeError: | |
|
86 | e_dict = {'password':_('Invalid characters in password')} | |
|
87 | raise formencode.Invalid('', value, state, error_dict=e_dict) | |
|
88 | ||
|
89 | if value.get('password_confirmation'): | |
|
90 | try: | |
|
91 | value['password_confirmation'] = \ | |
|
92 | get_crypt_password(value['password_confirmation']) | |
|
93 | except UnicodeEncodeError: | |
|
94 | e_dict = {'password_confirmation':_('Invalid characters in password')} | |
|
95 | raise formencode.Invalid('', value, state, error_dict=e_dict) | |
|
96 | ||
|
97 | return value | |
|
98 | ||
|
99 | class ValidPasswordsMatch(formencode.validators.FancyValidator): | |
|
100 | ||
|
101 | def validate_python(self, value, state): | |
|
102 | ||
|
103 | if value['password'] != value['password_confirmation']: | |
|
104 | e_dict = {'password_confirmation': | |
|
105 | _('Password do not match')} | |
|
106 | raise formencode.Invalid('', value, state, error_dict=e_dict) | |
|
81 | 107 | |
|
82 | 108 | class ValidAuth(formencode.validators.FancyValidator): |
|
83 | 109 | messages = { |
@@ -281,18 +307,34 b' def UserForm(edit=False, old_data={}):' | |||
|
281 | 307 | filter_extra_fields = True |
|
282 | 308 | username = All(UnicodeString(strip=True, min=1, not_empty=True), ValidUsername(edit, old_data)) |
|
283 | 309 | if edit: |
|
284 |
new_password = All(UnicodeString(strip=True, min=6, not_empty=False) |
|
|
310 | new_password = All(UnicodeString(strip=True, min=6, not_empty=False)) | |
|
285 | 311 | admin = StringBoolean(if_missing=False) |
|
286 | 312 | else: |
|
287 |
password = All(UnicodeString(strip=True, min=6, not_empty=True) |
|
|
313 | password = All(UnicodeString(strip=True, min=6, not_empty=True)) | |
|
288 | 314 | active = StringBoolean(if_missing=False) |
|
289 | 315 | name = UnicodeString(strip=True, min=1, not_empty=True) |
|
290 | 316 | lastname = UnicodeString(strip=True, min=1, not_empty=True) |
|
291 | 317 | email = All(Email(not_empty=True), UniqSystemEmail(old_data)) |
|
292 | 318 | |
|
319 | chained_validators = [ValidPassword] | |
|
320 | ||
|
293 | 321 | return _UserForm |
|
294 | 322 | |
|
295 | RegisterForm = UserForm | |
|
323 | def RegisterForm(edit=False, old_data={}): | |
|
324 | class _RegisterForm(formencode.Schema): | |
|
325 | allow_extra_fields = True | |
|
326 | filter_extra_fields = True | |
|
327 | username = All(ValidUsername(edit, old_data), UnicodeString(strip=True, min=1, not_empty=True)) | |
|
328 | password = All(UnicodeString(strip=True, min=6, not_empty=True)) | |
|
329 | password_confirmation = All(UnicodeString(strip=True, min=6, not_empty=True)) | |
|
330 | active = StringBoolean(if_missing=False) | |
|
331 | name = UnicodeString(strip=True, min=1, not_empty=True) | |
|
332 | lastname = UnicodeString(strip=True, min=1, not_empty=True) | |
|
333 | email = All(Email(not_empty=True), UniqSystemEmail(old_data)) | |
|
334 | ||
|
335 | chained_validators = [ValidPasswordsMatch, ValidPassword] | |
|
336 | ||
|
337 | return _RegisterForm | |
|
296 | 338 | |
|
297 | 339 | def PasswordResetForm(): |
|
298 | 340 | class _PasswordResetForm(formencode.Schema): |
@@ -1327,7 +1327,6 b' padding:0 0 2px;' | |||
|
1327 | 1327 | } |
|
1328 | 1328 | |
|
1329 | 1329 | #register div.title { |
|
1330 | width:420px; | |
|
1331 | 1330 | clear:both; |
|
1332 | 1331 | overflow:hidden; |
|
1333 | 1332 | position:relative; |
@@ -1337,7 +1336,6 b' padding:0;' | |||
|
1337 | 1336 | } |
|
1338 | 1337 | |
|
1339 | 1338 | #register div.inner { |
|
1340 | width:380px; | |
|
1341 | 1339 | background:#FFF; |
|
1342 | 1340 | border-top:none; |
|
1343 | 1341 | border-bottom:none; |
@@ -1346,7 +1344,7 b' padding:20px;' | |||
|
1346 | 1344 | } |
|
1347 | 1345 | |
|
1348 | 1346 | #register div.form div.fields div.field div.label { |
|
1349 |
width:1 |
|
|
1347 | width:135px; | |
|
1350 | 1348 | float:left; |
|
1351 | 1349 | text-align:right; |
|
1352 | 1350 | margin:2px 10px 0 0; |
@@ -1354,7 +1352,7 b' padding:5px 0 0 5px;' | |||
|
1354 | 1352 | } |
|
1355 | 1353 | |
|
1356 | 1354 | #register div.form div.fields div.field div.input input { |
|
1357 |
width: |
|
|
1355 | width:300px; | |
|
1358 | 1356 | background:#FFF; |
|
1359 | 1357 | border-top:1px solid #b3b3b3; |
|
1360 | 1358 | border-left:1px solid #b3b3b3; |
@@ -2235,7 +2233,7 b' padding:6px;' | |||
|
2235 | 2233 | } |
|
2236 | 2234 | |
|
2237 | 2235 | #login,#register { |
|
2238 |
width: |
|
|
2236 | width:520px; | |
|
2239 | 2237 | margin:10% auto 0; |
|
2240 | 2238 | padding:0; |
|
2241 | 2239 | } |
@@ -15,7 +15,7 b'' | |||
|
15 | 15 | <div id="register"> |
|
16 | 16 | |
|
17 | 17 | <div class="title top-left-rounded-corner top-right-rounded-corner"> |
|
18 |
<h5>${_('Sign Up to |
|
|
18 | <h5>${_('Sign Up to RhodeCode')}</h5> | |
|
19 | 19 | </div> |
|
20 | 20 | <div class="inner"> |
|
21 | 21 | ${h.form(url('register'))} |
@@ -27,16 +27,25 b'' | |||
|
27 | 27 | <label for="username">${_('Username')}:</label> |
|
28 | 28 | </div> |
|
29 | 29 | <div class="input"> |
|
30 | ${h.text('username')} | |
|
30 | ${h.text('username',class_="medium")} | |
|
31 | 31 | </div> |
|
32 | 32 | </div> |
|
33 | 33 | |
|
34 | 34 | <div class="field"> |
|
35 | 35 | <div class="label"> |
|
36 |
<label for="password">${_(' |
|
|
36 | <label for="password">${_('Password')}:</label> | |
|
37 | 37 | </div> |
|
38 | 38 | <div class="input"> |
|
39 | ${h.password('password')} | |
|
39 | ${h.password('password',class_="medium")} | |
|
40 | </div> | |
|
41 | </div> | |
|
42 | ||
|
43 | <div class="field"> | |
|
44 | <div class="label"> | |
|
45 | <label for="password">${_('Re-enter password')}:</label> | |
|
46 | </div> | |
|
47 | <div class="input"> | |
|
48 | ${h.password('password_confirmation',class_="medium")} | |
|
40 | 49 |
|
|
41 | 50 |
|
|
42 | 51 | |
@@ -45,7 +54,7 b'' | |||
|
45 | 54 | <label for="name">${_('First Name')}:</label> |
|
46 | 55 | </div> |
|
47 | 56 | <div class="input"> |
|
48 | ${h.text('name')} | |
|
57 | ${h.text('name',class_="medium")} | |
|
49 | 58 | </div> |
|
50 | 59 | </div> |
|
51 | 60 | |
@@ -54,7 +63,7 b'' | |||
|
54 | 63 | <label for="lastname">${_('Last Name')}:</label> |
|
55 | 64 | </div> |
|
56 | 65 | <div class="input"> |
|
57 | ${h.text('lastname')} | |
|
66 | ${h.text('lastname',class_="medium")} | |
|
58 | 67 | </div> |
|
59 | 68 | </div> |
|
60 | 69 | |
@@ -63,7 +72,7 b'' | |||
|
63 | 72 | <label for="email">${_('Email')}:</label> |
|
64 | 73 | </div> |
|
65 | 74 | <div class="input"> |
|
66 | ${h.text('email')} | |
|
75 | ${h.text('email',class_="medium")} | |
|
67 | 76 | </div> |
|
68 | 77 | </div> |
|
69 | 78 |
General Comments 0
You need to be logged in to leave comments.
Login now