Skip to content

Commit

Permalink
use a more realistic example for username validation
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 6, 2017
1 parent 3a22cdb commit 6b29ec8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

7.32 2017-04-24
7.32 2017-05-06

7.31 2017-04-23
- Removed deprecated files, slurp and spurt functions from Mojo::Util.
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Guides/Rendering.pod
Expand Up @@ -820,7 +820,7 @@ logic with methods like L<Mojolicious::Validator::Validation/"is_valid">.
return $c->render unless $validation->has_data;

# Validate parameters ("pass_again" depends on "pass")
$validation->required('user')->size(1, 20)->like(qr/^[e-t]+$/);
$validation->required('user')->size(1, 20)->like(qr/^[a-z0-9]+$/);
$validation->required('pass_again')->equal_to('pass')
if $validation->optional('pass')->size(7, 500)->is_valid;

Expand All @@ -842,7 +842,7 @@ logic with methods like L<Mojolicious::Validator::Validation/"is_valid">.
</head>
<body>
%= form_for index => begin
%= label_for user => 'Username (required, 1-20 characters, only e-t)'
%= label_for user => 'Username (required, 1-20 characters, a-z/0-9)'
<br>
%= text_field 'user', id => 'user'
%= submit_button
Expand Down

0 comments on commit 6b29ec8

Please sign in to comment.