summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-04-17 12:26:52 -0700
committerBharat Mediratta <bharat@menalto.com>2010-04-17 12:26:52 -0700
commit27b29afd7cf679f33429ce144871c1d96f137fbb (patch)
tree40a09bb112872074958706a3fdee21382fe3337b
parentca453413616d31d4c367526bdc9f480b23ba80db (diff)
Add user::valid_username() as a validation helper.
-rw-r--r--modules/user/helpers/user.php6
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