| @@ 31-39 (lines=9) @@ | ||
| 28 | const OTP_SECRET_PATTERN = '/^[A-Z0-9]{16}$/'; |
|
| 29 | const ACCESS_TOKEN_PATTERN = '/^[\x20-\x7E]+$/'; |
|
| 30 | ||
| 31 | public static function commonName($commonName) |
|
| 32 | { |
|
| 33 | if (0 === preg_match(self::COMMON_NAME_PATTERN, $commonName)) { |
|
| 34 | throw new HttpException('invalid value for "common_name"', 400); |
|
| 35 | } |
|
| 36 | if ('..' === $commonName) { |
|
| 37 | throw new HttpException('"common_name" cannot be ".."', 400); |
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||
| 41 | public static function userId($userId) |
|
| 42 | { |
|
| @@ 41-49 (lines=9) @@ | ||
| 38 | } |
|
| 39 | } |
|
| 40 | ||
| 41 | public static function userId($userId) |
|
| 42 | { |
|
| 43 | if (0 === preg_match(self::USER_ID_PATTERN, $userId)) { |
|
| 44 | throw new HttpException('invalid value for "user_id"', 400); |
|
| 45 | } |
|
| 46 | if ('..' === $userId) { |
|
| 47 | throw new HttpException('"user_id" cannot be ".."', 400); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| 51 | public static function disable($disable) |
|
| 52 | { |
|