| | |
| | | userInf.setUName("未登录的用户账号"); |
| | | userInf.setUId(0L); |
| | | userInf.setURole(0); |
| | | userInf.setUpassword("123456"); |
| | | }else{ |
| | | userInf=(UserInf) session.getAttribute("user"); |
| | | } |
| | |
| | | return FilenameUtils.getName(fileName); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 输入验证:路径遍历,防止恶意符号影响文件体系 |
| | | * 过滤掉特殊字符 ”/\" : | * ? < >” |
| | | */ |
| | | public static boolean filterPwd(String pwd){ |
| | | String regex="^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[!@#$%^&*()_+])[a-zA-Z\\d!@#$%^&*()_+]{8,}$"; |
| | | Pattern pattern = Pattern.compile(regex); |
| | | Matcher matcher = pattern.matcher(pwd); |
| | | return matcher.matches(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(filterPwd("Aa@123456")); |
| | | } |
| | | |
| | | } |