Browse Source

密码复杂度检测提醒

git-svn-id: https://192.168.57.71/svn/jsgkj@105 931142cf-59ea-a443-aa0e-51397b428577
ld_liufl 9 years ago
parent
commit
7ae573f6f9

+ 2 - 0
gkaq/yjpt-flex/trunk/locale/zh_CN/common.properties

@@ -84,6 +84,7 @@ form.no=\u5426
 form.yes=\u662f
 login.title=\u6c5f\u82cf\u7701\u6e2f\u53e3\u5b89\u5168\u76d1\u7ba1\u4e0e\u5e94\u6025\u7ba1\u7406\u7cfb\u7edf
 loginError=\u7528\u6237\u540d\u6216\u5bc6\u7801\u9519\u8bef\uff0c\u767b\u5f55\u5931\u8d25\uff01
+loginPasswordError=\u8be5\u7528\u6237\u7981\u6b62\u767b\u9646\uff0c\u767b\u9646\u5931\u8d25\uff01
 login.btnLogin=\u767b\u5f55
 login.btnRegist=\u6ce8\u518c
 login.download=\u7528\u6237\u64cd\u4f5c\u624b\u518c\u4e0b\u8f7d
@@ -206,6 +207,7 @@ logoutConfirmTitle=\u767b\u51fa\u7cfb\u7edf
 otherConfirm=\u786e\u8ba4\u64cd\u4f5c\uff1f
 otherConfirmTitle=\u786e\u8ba4\u4fe1\u606f
 
+password.yxq=\u60a8\u5f53\u524d\u5bc6\u7801\u4e0d\u6ee1\u8db3\u590d\u6742\u5ea6\u8981\u6c42\uff088\u4f4d\u53ca\u4ee5\u4e0a\u5e76\u5305\u62ec\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u7279\u6b8a\u5b57\u7b26\uff09\uff0c\u5f53\u524d\u5bc6\u7801\u8fd8\u53ef\u4ee5\u7ee7\u7eed\u4f7f\u7528\u81f3{0}\uff0c\u5efa\u8bae\u60a8\u7acb\u5373\u4fee\u6539\u5bc6\u7801\uff01
 session.timeout=\u4f1a\u8bdd\u8d85\u65f6\uff0c\u8bf7\u91cd\u65b0\u767b\u5f55\uff01
 systemError=\u7cfb\u7edf\u9519\u8bef
 systemTip=\u7cfb\u7edf\u63d0\u793a

+ 10 - 0
gkaq/yjpt-flex/trunk/src/com/jtgh/yjpt/model/SystemModel.as

@@ -9,18 +9,22 @@ package com.jtgh.yjpt.model
 	import com.jtgh.yjpt.select.YesNoSelect;
 	import com.jtgh.yjpt.view.Workspace;
 	import com.jtgh.yjpt.view.core.LoginPanel;
+	import com.jtgh.yjpt.view.core.PassWordYxq;
 	import com.jtgh.yjpt.vo.access.UserVo;
 	import com.jtgh.yjpt.vo.common.CodeVo;
 	import com.jtgh.yjpt.vo.sys.ButtonVo;
 	import com.jtgh.yjpt.vo.sys.MenuVo;
 	
+	import flash.display.DisplayObject;
 	import flash.events.Event;
 	import flash.utils.Dictionary;
 	import flash.utils.getDefinitionByName;
 	
+	import mx.core.FlexGlobals;
 	import mx.core.UIComponent;
 	import mx.core.mx_internal;
 	import mx.events.FlexEvent;
+	import mx.resources.ResourceManager;
 	
 	import spark.components.Group;
 
@@ -181,6 +185,12 @@ package com.jtgh.yjpt.model
 				Global.selectedSecondMenuVo=Global.initMenu;
 				menuClick(Global.initMenu);
 			}
+			if(!Global.user.pdsfyx){
+				thisModel.mainLayout.addEventListener(FlexEvent.CREATION_COMPLETE,function(e:Event):void{		
+					var yxq:PassWordYxq= new PassWordYxq;
+					Utils.popupWindow(ResourceManager.getInstance().getString("common","tip"),yxq,FlexGlobals.topLevelApplication as DisplayObject,null,300,150);
+				});	
+			}				
 		}
 
 		/*********

+ 47 - 0
gkaq/yjpt-flex/trunk/src/com/jtgh/yjpt/view/core/PassWordYxq.mxml

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
+		 xmlns:s="library://ns.adobe.com/flex/spark" 
+		 xmlns:mx="library://ns.adobe.com/flex/mx" 
+		 creationComplete="creationCompleteHandler(event)"
+		 width="300" height="150">
+	<fx:Script>
+		<![CDATA[
+			import com.jtgh.yjpt.common.Global;
+			import com.jtgh.yjpt.common.util.Utils;
+			
+			import mx.events.CloseEvent;
+			import mx.events.FlexEvent;
+			import mx.resources.ResourceManager;
+			[Bindable]
+			public var thisView:PassWordYxq;
+			protected function creationCompleteHandler(event:FlexEvent):void
+			{
+				var arr:Array = new Array();
+				arr.push(Global.user.pdyxqStr);
+				tx.text=ResourceManager.getInstance().getString('common','password.yxq',arr);				
+			}
+			
+			protected function doChange(event:MouseEvent):void{
+				var changePwdView:ChangePwd = new ChangePwd;
+				changePwdView.changeByAdmin = false;
+				changePwdView.userCode = Global.user.code;
+				Utils.popupWindow(ResourceManager.getInstance().getString("common","changePwd.title"),changePwdView, this as DisplayObject ,function():void{			
+					doClose(null);
+					},300,220);			
+			}
+					
+			protected function doClose(event:MouseEvent):void
+			{
+				this.dispatchEvent(new CloseEvent(CloseEvent.CLOSE));		
+			}
+			
+		]]>
+	</fx:Script>
+	<s:VGroup width="100%" height="100%" horizontalAlign="center" verticalAlign="middle" top="10" bottom="10" gap="15">
+		<s:Label id="tx"  width="100%" />
+		<s:HGroup width="100%" height="40" horizontalAlign="center">
+			<s:Button id="saveBtn" label="修改" click="doChange(event)" enabled="true" skinClass="skins.cus.ButtonSkin"/>
+			<s:Button id="closeBtn" label="{resourceManager.getString('common','btn.close')}" click="doClose(event)"  skinClass="skins.cus.ButtonSkin"/>
+		</s:HGroup>
+	</s:VGroup>
+</s:Group>

+ 22 - 0
gkaq/yjpt-flex/trunk/src/com/jtgh/yjpt/vo/access/UserVo.as

@@ -5,6 +5,8 @@ package com.jtgh.yjpt.vo.access
 	import com.jtgh.yjpt.vo.aqpjjgxx.AqpjjgxxVo;
 	import com.jtgh.yjpt.vo.common.CodeVo;
 	import com.jtgh.yjpt.vo.jyr.JyrVo;
+	
+	import mx.formatters.DateFormatter;
 
 	[Bindable]
 	[RemoteClass(alias="com.jtgh.yjpt.entity.auth.UserEntity")]
@@ -59,6 +61,8 @@ package com.jtgh.yjpt.vo.access
 		public var  jsdw:JsfxxwhVo;
 		/**是否船代*/
 		public var sfcd:String=YesNoSelect.NO;
+		/** 密码有效期*/
+		public var pdyxq:Date;
 
 		public function get yxdl():Boolean
 		{
@@ -201,5 +205,23 @@ package com.jtgh.yjpt.vo.access
 				sfcd = YesNoSelect.NO;
 			}
 		}
+		
+		/** 密码是否有效*/
+		public function get pdsfyx():Boolean{
+			if(pdyxq==null){
+				return true;
+			}		
+			return false;
+		}
+		public function  get pdyxqStr():String{
+			var  forString:String="YYYY-MM-DD";
+			var format:DateFormatter=new DateFormatter();
+			format.formatString=forString;
+			if(null!=pdyxq)
+				return format.format(pdyxq);
+			return "";	
+		}
+						
+
 	}
 }

+ 4 - 0
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/common/Constants.java

@@ -266,6 +266,10 @@ public class Constants {
 	 */
 	public static String ZYSB_CHECK_72 = Constants.YES;
 	/**
+	 * 密码有效期
+	 */
+	public  static  int PASSWORD_YXQ=7;
+	/**
 	 * 菜单类型
 	 * <p>
 	 * 0:主菜单

+ 4 - 0
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/common/GlobalData.java

@@ -175,6 +175,10 @@ public class GlobalData {
 		if(StringUtils.hasLength(prop)) {
 			Utils.setField(null, prop, "ZYSB_CHECK_72", Constants.class);
 		}
+		prop = String.valueOf(p.get("password.yxq"));
+		if(StringUtils.hasLength(prop)) {
+			Utils.setField(null, Integer.parseInt(prop), "PASSWORD_YXQ", Constants.class);
+		}
 		
 	}
 

+ 12 - 1
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/controller/auth/AuthenticateController.java

@@ -11,6 +11,7 @@ import java.security.SecureRandom;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Random;
 import java.util.UUID;
@@ -135,6 +136,8 @@ public class AuthenticateController extends BaseController {
 			bc.setAttribute("uploadImageSize", GlobalData.UPLOAD_IMAGE_SIZE);
 			bc.setAttribute("btyyj", codeService.findOne(11200015l).getBz());
 			bc.setAttribute("thyj", codeService.findOne(11200016l).getBz());
+			//设置是否在危险品审批中使用签章功能的参数
+			bc.setAttribute("iSignature", GlobalData.iSignature);
 		} else {
 			bc.setAttribute("status", true);
 			// bc.setAttribute("user", user);
@@ -351,7 +354,14 @@ public class AuthenticateController extends BaseController {
 		}
 		UserEntity user = authenticateService.doLogin(usercode, password);
 		if (null != user) {
-			processLogin(bc, user);
+			if(user.getPdyxq()!=null) {
+				Date yxq =Utils.getDateLastTime( user.getPdyxq());
+				if(yxq.compareTo(new Date())<=0) {
+					bc.addMsg("loginPasswordError", "common", MsgLevel.ERROR);
+					return bc; 
+				}
+			}	 
+			processLogin(bc, user);			
 		} else {
 			bc.addMsg("loginError", "common", MsgLevel.ERROR);
 		}
@@ -441,6 +451,7 @@ public class AuthenticateController extends BaseController {
 			UserEntity user = l.get(0);
 			if (changeByAdmin || user.getPassword() != null
 					&& user.getPassword().equals(Utils.encrypt(oldPwd))) {
+				user.setPdyxq(null);
 				user.setPassword(Utils.encrypt(newPwd));
 				userService.save(user);
 			} else {

+ 11 - 0
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/entity/auth/UserEntity.java

@@ -134,6 +134,9 @@ public class UserEntity extends BaseEntity<Long> {
 	
 	/** 是否船代 **/
 	private String sfcd = null;
+	
+	/**密码有效期*/
+	private Date pdyxq;
 
 	public String getBgdz() {
 		return bgdz;
@@ -382,4 +385,12 @@ public class UserEntity extends BaseEntity<Long> {
 		this.sfcd = sfcd;
 	}
 
+	public Date getPdyxq() {
+		return pdyxq;
+	}
+
+	public void setPdyxq(Date pdyxq) {
+		this.pdyxq = pdyxq;
+	}
+
 }

+ 16 - 0
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/service/impl/auth/AuthenticateServiceImpl.java

@@ -1,7 +1,11 @@
 package com.jtgh.yjpt.service.impl.auth;
 
 import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
 import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import javax.servlet.http.HttpSession;
 
@@ -43,6 +47,17 @@ public class AuthenticateServiceImpl implements AuthenticateService {
 					&& Utils.pwdEquals(password, user.getPassword())) {
 				// HttpSession session =
 				// FlexContext.getHttpRequest().getSession();
+				if(user.getPdyxq()==null) {
+					Pattern p = Pattern.compile("^(?=.*?[a-zA-Z])(?=.*?\\d)(?=.*?[-`=\\\\\\[\\];',.\\/~!@#$%^&*()_+|{}:<>\"]).{8,}$");  	  
+					Matcher m = p.matcher(password);  
+					if(!m.find()) {
+					   Calendar nowtime= Calendar.getInstance();
+					   nowtime.setTime(new Date());
+					   nowtime.add(Calendar.DAY_OF_MONTH, Constants.PASSWORD_YXQ);
+					   user.setPdyxq(nowtime.getTime());
+					   user = userDao.save(user);
+					}
+				} 
 				HttpSession session = Utils.getSession();
 				if (user.getJyrjcxx() != null) {
 					user.getJyrjcxx().getGkjyr();
@@ -53,6 +68,7 @@ public class AuthenticateServiceImpl implements AuthenticateService {
 					user.getAddUser().getCode();
 				if (user.getUpdateUser() != null)
 					user.getUpdateUser().getCode();
+
 				session.setAttribute(GlobalData.USER_SESSION_KEY, user);
 				return user;
 			}

+ 2 - 0
gkaq/yjpt-java/trunk/locale/zh_CN/common.properties

@@ -83,6 +83,7 @@ form.no=\u5426
 form.yes=\u662f
 login.title=\u6c5f\u82cf\u7701\u6e2f\u53e3\u5b89\u5168\u76d1\u7ba1\u4e0e\u5e94\u6025\u7ba1\u7406\u7cfb\u7edf
 loginError=\u7528\u6237\u540d\u6216\u5bc6\u7801\u9519\u8bef\uff0c\u767b\u5f55\u5931\u8d25\uff01
+loginPasswordError=\u8be5\u7528\u6237\u7981\u6b62\u767b\u9646\uff0c\u767b\u9646\u5931\u8d25\uff01
 login.btnLogin=\u767b\u5f55
 login.btnRegist=\u6ce8\u518c
 login.download=\u7528\u6237\u64cd\u4f5c\u624b\u518c\u4e0b\u8f7d
@@ -204,6 +205,7 @@ logoutConfirmTitle=\u767b\u51fa\u7cfb\u7edf
 otherConfirm=\u786e\u8ba4\u64cd\u4f5c\uff1f
 otherConfirmTitle=\u786e\u8ba4\u4fe1\u606f
 
+password.yxq=\u60a8\u5f53\u524d\u5bc6\u7801\u4e0d\u6ee1\u8db3\u590d\u6742\u5ea6\u8981\u6c42\uff088\u4f4d\u53ca\u4ee5\u4e0a\u5e76\u5305\u62ec\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u7279\u6b8a\u5b57\u7b26\uff09\uff0c\u5f53\u524d\u5bc6\u7801\u8fd8\u53ef\u4ee5\u7ee7\u7eed\u4f7f\u7528\u81f3{0}\uff0c\u5efa\u8bae\u60a8\u7acb\u5373\u4fee\u6539\u5bc6\u7801\uff01
 session.timeout=\u4f1a\u8bdd\u8d85\u65f6\uff0c\u8bf7\u91cd\u65b0\u767b\u5f55\uff01
 systemError=\u7cfb\u7edf\u9519\u8bef
 systemTip=\u7cfb\u7edf\u63d0\u793a