1. SiteUtil.as

.....

    public class SiteUtil
    {
        public static function login(id:String, systemId:String, locale:String, company:String, isNewVendor:String, password, callback:Function):void{
            var set:ChannelSet = new ChannelSet();
            var context:String = Application.application.parameters.context;
            set.addChannel(new AMFChannel("my-amf", context+"/messagebroker/amf"));
            
            var token:AsyncToken = set.login(id + "||" + systemId + "||" + locale + "||" + company + "||" + isNewVendor, password, "utf-8");
            
            token.addResponder(new AsyncResponder(function(event:ResultEvent, token:Object = null):void
            {
                if (callback)
                    callback.apply();
            }, function(event:FaultEvent, token:Object = null):void
            {
                
//                var faultString:String = "로그인에 실패하였습니다.";
//                
//                if (event.fault.faultCode.indexOf("No Such User") >= 0) 
//                {
//                    faultString = "로그인에 실패하였습니다.\n아이디 또는 비밀번호를 다시 확인하세요.";
//                }
//                else if (event.fault.faultCode.indexOf("Lock User") >= 0)
//                {
//                    faultString = "비밀번호 오류횟수를 5회 이상 초과 하였습니다.\n담당자에게 문의 하세요.";
//                }
//                else if (event.fault.faultCode.indexOf("No Use Buyer") >= 0)
//                {
//                    faultString = "6개월이상 미사용자로 계정이 잠겼습니다.\n담당자에게 문의 하세요.";
//                }
//                else if (event.fault.faultCode.indexOf("No Use Supplier") >= 0)
//                {
//                    faultString = "12개월이상 미사용자로 계정이 잠겼습니다.\n담당자에게 문의 하세요.";
//                }
//                else if (event.fault.faultCode.indexOf("Bad Credential") >= 0)
//                {
//                    faultString = "로그인에 실패하였습니다.\n아이디 또는 비밀번호를 다시 확인하세요.";
//                }
//                else
//                {
//                    faultString = "로그인에 실패하였습니다.\n서버와의 연결에 실패하였습니다.";
//                }
                
                var faultString:String = event.fault.faultString;
                
                if (faultString == "" || faultString == null)
                {
                    faultString = "login failed.\nThe connection to the server has failed.";
                }
                
                ExternalInterface.call("clearField");
                ExternalInterface.call("alert", [faultString]);
            }));
        }

....


JavaScript

 

2. VolcanoLoginCommand.java

...

    public Principal doAuthentication(final String userName, Object password) 
    {
        Map<String, Object> user;
        String credential = extractPassword(password);
        Map<String,Object> param = new HashMap<String,Object>();
        
        String info[] = userName.split("\\|\\|");
        final String id      = info[0];
        final String system  = info[1];
        final String locale  = info[2];
        final String company = info[3];
        final String isNewVendor = info[4];
        
        param.put("usr_id",  id);
        param.put("sys_id",  system);
        param.put("locale",  locale);
        param.put("comp_cd", company);
        param.put("pwd",     credential);
        
        TransactionManager.getInstance().transact();
        String error = null;
        String message = null;
        
        try
        {
            JdbcAgency jdbc = new JdbcAgency();
            jdbc.setDefaults(ConfigUtils.getVirtualSessionUser());
            Map<String,Object> map = jdbc.executeQuery("login", "login.check.select", param);
            
            HttpServletRequest request = FlexContext.getHttpRequest();
            Helper helper = new Helper(request ,new eswf.dataobject.Map());
            
            SecurityPw ChkPw = new SecurityPw();
            
            if(map == null)
            {
                error = "No Such User";
                
                if ("ko_KR".equals(locale))
                {
                    message = "로그인에 실패하였습니다.\n아이디 또는 비밀번호를 다시 확인하세요.";
                }
                else
                {
                    message = "login failed.";
                }
            }
            else if (Integer.parseInt(map.get("pw_miss_cnt").toString()) >= Integer.parseInt(ChkPw.getPwlimit("lock")))
            {
                error = "Lock User";
                
                if ("ko_KR".equals(locale))
                {
                    message = String.format("비밀번호 오류횟수를 %s회 이상 초과 하였습니다.\n담당자에게 문의 하세요.", ChkPw.getPwlimit("lock"));
                }
                else
                {
                    message = String.format("Password failure count has been exceeded more than %s times.\nPlease contact your administrator.", ChkPw.getPwlimit("lock"));
                }
            }
            else if ("B".equals(map.get("usr_cls")) && Integer.parseInt(map.get("nouse_month").toString()) > Integer.parseInt(ChkPw.getPwlimit("nouseMonthB")))
            {
                error = "No Use Buyer";
                
                if ("ko_KR".equals(locale))
                {
                    message = String.format("%s개월이상 미사용자로 계정이 잠겼습니다.\n담당자에게 문의 하세요.", ChkPw.getPwlimit("nouseMonthB"));
                }
                else
                {
                    message = String.format("The account is not used for more than %s months. This account has been locked.\\nPlease contact your administrator.", ChkPw.getPwlimit("nouseMonthB"));
                }
            }
            else if ("S".equals(map.get("usr_cls")) && Integer.parseInt(map.get("nouse_month").toString()) > Integer.parseInt(ChkPw.getPwlimit("nouseMonthS")))
            {
                error = "No Use Supplier";
                
                if ("ko_KR".equals(locale))
                {
                    message = String.format("%s개월이상 미사용자로 계정이 잠겼습니다.\n담당자에게 문의 하세요.", ChkPw.getPwlimit("nouseMonthS"));
                }
                else
                {
                    message = String.format("The account is not used for more than %s months. This account has been locked.\\nPlease contact your administrator.", ChkPw.getPwlimit("nouseMonthS"));
                }
            }
            else if(!credential.equals(map.get("pwd")) && !"ssopass".equals(credential))
            {
                error = "Bad Credential";

                if ("ko_KR".equals(locale))
                {
                    message = "로그인에 실패하였습니다.\n아이디 또는 비밀번호를 다시 확인하세요.";
                }
                else
                {
                    message = "login failed.";
                }
                
                jdbc.executeUpdate("login","update.login.fail",param);
            }
            else
            {
                map.put("comp_cd", company);
                map.put("remote_addr", request.getRemoteAddr());
                map.put("pwchangeday",ChkPw.getPwlimit("pwchg")); 
                user = jdbc.executeQuery("login","login.session.data.select",map); 
                jdbc.executeUpdate("login","update.last.login.info",map);
                user.put("locale", locale);
                
                if(!"company".equals(company))
                {
                    user.put("comp_cd"  , company);
                    user.put("s_comp_cd", company);
                }

                // 새로 가입한 업체라면
                if ("Y".equals(isNewVendor)) {
                    user.put("isNewVendor", "Y");
                }
                
                request.getSession().setAttribute("user_menus",jdbc.executeQueryList("login","login.session.menu.select",user));
                
                helper.login((eswf.dataobject.Map)user);
            }
            TransactionManager.getInstance().accept();
        }
        catch(Exception e)
        {
            error = e.getMessage();
            try 
            {
                TransactionManager.getInstance().restore();
            } 
            catch (FoundationException e1) 
            {
                error = e.getMessage();
            }
        }
        finally{
            TransactionManager.getInstance().removeSession();
        }
        
        if(error != null)
        {
            SecurityException se = new SecurityException();
            se.setCode(error);
            se.setMessage(message);
            throw se;
        }
        return new Principal() 
        {
            public String getName() 
            {
                return id;
            }
        };
    }

...
Java