diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-04-17 12:26:52 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-04-17 12:26:52 -0700 |
commit | 27b29afd7cf679f33429ce144871c1d96f137fbb (patch) | |
tree | 40a09bb112872074958706a3fdee21382fe3337b /modules | |
parent | ca453413616d31d4c367526bdc9f480b23ba80db (diff) |
Add user::valid_username() as a validation helper.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/user/helpers/user.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/user/helpers/user.php b/modules/user/helpers/user.php index 650dcf6a..1ad4bbd2 100644 --- a/modules/user/helpers/user.php +++ b/modules/user/helpers/user.php @@ -76,6 +76,12 @@ class user_Core { } } + static function valid_username($text_input) { + if (!self::lookup_by_name($text_input->value)) { + $text_input->add_error("invalid_username", 1); + } + } + /** * Create the hashed passwords. * @param string $password a plaintext password |