#parse("resourcebundle_en.vm") #if ($includeProfileMethods) #set ($includePasswordValidator = true) #set ($includeUsernameValidator = true) #end #if (!$alreadyIncludedUserMgt) var g_formUtils = new FormUtils(); function UserMgt(){} #set ($alreadyIncludedUserMgt = true) #end #if ($includePasswordValidator && !$alreadyIncludedUserMgtPW) #set ($includeStringValidator = true) #if (false) /*----------------------------------------------------------------*\ | This method determines if the specified char is within the range | | of valid password characters. | | | | Valid password characters are those characters from #32 - #126. | | | | @param c A password character. | | @return true if the password character is valid; otherwise false.| \*----------------------------------------------------------------*/ #end UserMgt.prototype.isValidPasswordChar = function (c) { return ((c >= " ") && (c <= "~")) } #if (false) /*----------------------------------------------------------------*\ | This method determines if the specified password is formatted | | properly. | | | | Valid password characters are those characters from #32 - #126. | | | | @param s The password. | | @return Error code indicating the result of the operation. | | Possible Values: | | SUCCESS = 0 | | INVALID_CHAR_ENCOUNTERED = 1; | | MAX_LENGTH_EXCEEDED = 2; | | MIN_LENGTH_EXCEEDED = 3; | \*----------------------------------------------------------------*/ #end UserMgt.prototype.isPasswordFormatValid = function (s,allowEmpty) { //return g_formUtils.isStringFormatValid(this.isValidPasswordChar,s,allowEmpty); return 0; } #if (false) /*----------------------------------------------------------------*\ | This method determines if the specified password is valid. | | | | @param password The password. | | @return Error message indicating result. | \*----------------------------------------------------------------*/ #end UserMgt.prototype.validPasswordFormat = function (password) { var errorMsg = null; var isValidPassword = this.isPasswordFormatValid(password,true); if (isValidPassword != g_formUtils.SUCCESS) { if (isValidPassword == g_formUtils.MAX_LENGTH_EXCEEDED) errorMsg = "$PASSWORD_MAX_LENGTH_EXCEEDED" ; else errorMsg = "$PASSWORD_INVALID_FORMAT" ; } return errorMsg; } #set ($alreadyIncludedUserMgtPW = true) #end #if ($includeUsernameValidator && !$alreadyIncludedUserMgtUN) #set ($includeStringValidator = true) #if (false) /*----------------------------------------------------------------*\ | This method determines if the specified char is within the range | | of valid username characters. | | | | Valid username characters are any alphanumeric character. | | | | @param c A username character. | | @return true if the username character is valid; otherwise false.| \*----------------------------------------------------------------*/ #end UserMgt.prototype.isValidUsernameChar = function (c) { return (g_formUtils.isLetter(c) || g_formUtils.isDigit(c) || (c == '_') || (c == '-')); } #if (false) /*----------------------------------------------------------------*\ | This method determines if the specified username is formatted | | properly. | | | | Valid username characters are any alphanumeric. | | | | @param s The username. | | @return Error code indicating the result of the operation. | | Possible Values: | | SUCCESS = 0 | | INVALID_CHAR_ENCOUNTERED = 1; | | MAX_LENGTH_EXCEEDED = 2; | | MIN_LENGTH_EXCEEDED = 3; | \*----------------------------------------------------------------*/ #end UserMgt.prototype.isUsernameFormatValid = function (s,allowEmpty) { // return g_formUtils.isStringFormatValid(this.isValidUsernameChar,s,allowEmpty); return 0; } #if (false) /*----------------------------------------------------------------*\ | This method determines if the specified username is valid. | | | | @param username The username. | | @return Error message indicating result. | \*----------------------------------------------------------------*/ #end UserMgt.prototype.validUsernameFormat = function (username) { var errorMsg = null; var isValidUsername = this.isUsernameFormatValid(username,false); if (isValidUsername != g_formUtils.SUCCESS) { if (isValidUsername == g_formUtils.MAX_LENGTH_EXCEEDED) errorMsg = "$LOGIN_NAME_MAX_LENGTH_EXCEEDED" ; else if (isValidUsername == g_formUtils.MIN_LENGTH_EXCEEDED) errorMsg = "$LOGIN_NAME_MIN_LENGTH_EXCEEDED" ; else errorMsg = "$LOGIN_NAME_INVALID_FORMAT" ; } return errorMsg; } #set ($alreadyIncludedUserMgtUN = true) #end #if (!$JS_FORM_UTILS) #set ($includeStringValidator = true) #parse("formutils.vm") #end