<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" import="java.util.*, java.util.regex.*, java.util.Date" import="java.text.SimpleDateFormat, java.text.DateFormat" import="javax.naming.directory.*" import="javax.mail.Session, javax.mail.Message, javax.mail.Transport" import="javax.mail.internet.MimeMessage" import="javax.mail.internet.InternetAddress" import="util.PropertiesUtil, util.utilTools, util.CipherOut" import="ldap.LdapEnv, ldap.LdapUtil" import="exception.ErrorMessage"%> <% request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); /* 変数初期化 */ int pgErr = 0; String wStr = ""; String dbg = ""; // Debug String wMsg = ""; int wCt = 0; String OErr = ""; //入力チェックエラーメッセージ PropertiesUtil prop = PropertiesUtil.getInstance(); CipherOut cip = new CipherOut("Cipherwmd2017SET"); // 16文字固定に注意 String notIncludedChars = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~0OIl1"; //パラメータ用 String eMail = ""; // UID String strPw = ""; // パスワード String strKisiID = ""; // 開催ID String strCtl = ""; String[] wPTb = null; int fTb = 0; int fPrc = 0; int reqMail = 0; String[] LdapT = null; //講演ユーザ情報取得用 List lstMaster = null; // ユーザ情報 String strErrMsg = ""; //エラーメッセージ //パラメータ取得 strCtl = request.getParameter("pctl"); // Page Step if(strCtl == null || strCtl.length() == 0){ strCtl = ""; pgErr |= 2; } eMail = request.getParameter("email"); // email if(eMail == null || eMail.length() == 0){ eMail = ""; pgErr |= 4; } strPw = request.getParameter("cpw"); // password if(strPw == null || strPw.length() == 0){ strPw = ""; pgErr |= 8; } strKisiID = request.getParameter("kisiid"); // 開催ID strKisiID = "none"; if(strKisiID == null || strKisiID.length() == 0){ strKisiID = ""; pgErr |= 16; } String wPara = request.getParameter("pd"); // email if(wPara == null || wPara.length() == 0){ wPara = ""; // 複合化 }else{ strPw = (((((wPara.replaceAll("@1@", "&")).replaceAll("@2@", "\\?")).replaceAll("@3@", "\\+")).replaceAll("@4@", "\\/")).replaceAll("@5@", "=")); wPara = cip.decrypt(strPw); try{ wCt = Integer.parseInt(wPara); }catch (Exception e){ wCt = 0; } if( wCt > -1 ){ wPTb = wPara.split("<>"); fTb = 1; } } if( wPTb == null ){ wPTb = new String[3]; wPTb[0] = ""; wPTb[1] = ""; wPTb[2] = ""; fTb = 0; } // Reload 対策 String ReLd = (String)session.getAttribute("prcend"); if(ReLd == null || ReLd.length() < 1){ ReLd = ""; } // Reload 対策(初期化) if( strCtl.equals("1") || fTb == 1 ){ session.setAttribute("prcend", "0"); ReLd = "0"; } //初期表示時 LdapUtil LDH = new LdapUtil(); String admuid = prop.getProperty("idmgr_cert_cn").trim(); String admpw = LdapEnv.CERT_PASS; String usrplc = prop.getProperty("idmgr_master_plc").trim(); String strSendAdr = ""; //送信メール付加アドレス String MBody = ""; // ページ制御&eMail&開催ID(Dammy)が有効な時 if( ((pgErr & 22) != 22 || fTb == 1 ) && ReLd.equals("1") == false ){ try { LDH.getConnection(admuid, admpw, ""); // LDAPへ接続 // Masterデータ存在確認 wStr = (fTb == 1)?wPTb[0]:eMail; lstMaster = LDH.getUserData(wStr, 2); LDH.ConnectionClose(); // LDap Close if( lstMaster.size()>0 ){ LdapT = (String[])lstMaster.get(0); }else{ pgErr |= 1; } if( fTb != 1 ){ // データ更新 if( strCtl.equals("mod") && OErr.length() == 0 ){ LDH.getConnection(admuid, admpw, ""); // LDAPへ接続 // 更新オブジェクト生成 Attribute[] Atr = new Attribute[2]; // 1.パスワード Atr[0] = new BasicAttribute( LDH.PE_UPW ); Atr[0].add( strPw ); // 2.更新日時 Date dt = new Date(); DateFormat dfm = new SimpleDateFormat("yyyyMMddHHmmss"); String nowDt = dfm.format(dt); Atr[1] = new BasicAttribute( LDH.PE_UTM ); Atr[1].add( nowDt ); //ユーザ情報更新(Master) if( eMail.length()>0 && strPw.length()>0 ){ LDH.modUserData(Atr, eMail, usrplc); wMsg = "alert('パスワード変更しました');"; } LDH.ConnectionClose(); // LDap Close reqMail = 1; // メール送信 // 入力ページ送信 }else if( strCtl.equals("chg") && OErr.length() == 0 ){ // ランダムパスワード生成 String wPw = ""; int pwlen = 8; char random; for( wCt=0; wCt 'z' || notIncludedChars.indexOf(random) != -1); wPw += random; } wStr = LdapT[0] +"<>"+ wPw +"<>"+ LdapT[18]; strPw = ((((((cip.encrypt(wStr)).replaceAll("&", "@1@")).replaceAll("\\?", "@2@")).replaceAll("\\+", "@3@")).replaceAll("\\/", "@4@")).replaceAll("=", "@5@")); reqMail = 1; // メール送信 } //Mail送信 if( reqMail == 1 && (strCtl.equals("chg") || strCtl.equals("mod")) ){ reqMail = 2; String SMTP = prop.getProperty("idmgr_smtp_mail").trim(); String MFrom = prop.getProperty("idmgr_from_mail").trim(); //String MBcc = strSendAdr; String MBcc = ""; Properties props = System.getProperties(); props.put("mail.smtp.host",SMTP); // SMTP Set javax.mail.Session Msession = javax.mail.Session.getDefaultInstance(props,null); MimeMessage email = new MimeMessage(Msession); // 送信元アドレスと送信者名 email.setFrom(new InternetAddress(MFrom,"","iso-2022-jp")); // 送信先アドレス email.setRecipients(Message.RecipientType.TO,eMail); if( !MBcc.equals("") ){ email.setRecipients(Message.RecipientType.BCC,MBcc); //管理者 } // メールタイトル if( strCtl.equals("chg") ){ email.setSubject("パスワード変更依頼 (For JWRI Region)","iso-2022-jp"); } if( strCtl.equals("mod") ){ email.setSubject("パスワード変更完了のご連絡 (For JWRI Region)","iso-2022-jp"); } // メール本文 MBody = ""+ LdapT[6] +" "+ LdapT[7] +" 様\n\n"; if( strCtl.equals("chg") ){ MBody += "パスワード変更を完了するためには、以下のURLにアクセスしてください\n\n"; MBody += "http://www.jwri.osaka-u.ac.jp/~conf/wmd2017/pwonetime.jsp?pd="+ strPw; } if( strCtl.equals("mod") ){ MBody += "パスワード変更が完了しましたので、ご確認ください\n\n"; MBody += "Login ID : "+ eMail +"\n"; MBody += "Password : "+ strPw +"\n\n"; MBody += "以降のログインには、本情報をご利用ください\n"; MBody += "http://www.jwri.osaka-u.ac.jp/~conf/wmd2017/"; } MBody += "\n\nご注意:\n もし、本更新にお心当たり無い場合は、\n サイト管理者までご連絡いただけますよう\n よろしくお願いいたします。\n\n"; MBody += " このEメールは配信専用となっております。\n このメールアドレスにご返信いただいてもご返事ができません。\n"; MBody += "*************************************************\n 溶接構造シンポジウム2017 事務局\n E-Mail: "+ MFrom +"\n*************************************************\n"; email.setText(MBody,"iso-2022-jp"); // メール形式&送信日付 email.setHeader("Content-Type","Text/Plain; charset=iso-2022-jp"); email.setHeader("Content-Transfer-Encoding", "7bit"); email.setSentDate(new Date()); // 送信 Transport.send(email); fPrc = 1; } } if( OErr.length()>0 ){ OErr += " 空欄です"; } if( fPrc == 1 ){ session.setAttribute("prcend", "1"); } }catch (Exception e){ ErrorMessage em = new ErrorMessage(); em.makeErrorMessage(request.getServletPath(), request.getParameterMap(), e); log(em.getLogErrorMsg(), e); OErr = LDH.getErrMsg(LDH.errcode) +""; } // Reload 対策(表示) }else if( ReLd.equals("1") ){ if( strCtl.equals("chg") ){ fPrc = 1; } } %> 溶接構造シンポジウム2017
ログインパスワードをお忘れの方 (登録アカウント)
<%=(OErr.length()>0)?OErr +"
":" "%>
<% if( strCtl.equals("mod") == false && fTb != 1 ){ %> <% }%>

<% // eMail と ページ制御入力無しでかつ 暗号引数ありの場合 if( (pgErr & 6) == 6 && fTb>0 ){ // URL発行時と同じユーザ更新日の時のみ更新処理 if( (pgErr & 1) != 1 && LdapT[18].equals(wPTb[2]) ){ %>
以下の情報でパスワード再発行します。よろしいですか?

 Login ID(E-Mail)  <%=wPTb[0]%>
 パスワード  <%=wPTb[1]%>

上記、情報でパスワード変更します。「設定」をクリックして変更を完了してください

ご登録のメールアドレス宛にパスワード変更後に完了通知をメールでご連絡致します。

<% }else{%>
連続の変更設定はできません。
もし、再度パスワード変更をご希望される場合は、ログインページからお願いします

<% } }else if( strCtl.equals("1") ){ %>
ログインする時に必要な『ログインパスワード』をお忘れの方はこちらから再発行できます

ご登録のE-Mailアドレスを入力し、「次へ」をクリックしてください

ご登録のメールアドレス宛にパスワード設定のためのURLをメールでご連絡致します。
そのURLにアクセス頂くことで、新しいパスワードを確認することができます。

  印は、入力必須項目です
  登録 E-Mail  

<% }else if( strCtl.equals("chg") && fPrc == 1 ){ %>
ご登録のメールアドレス宛にパスワード設定のためのURLを送信しました。

<% }else if( strCtl.equals("mod") ){ %>
パスワードの再発行が完了しました

 Login ID(E-Mail)  <%=eMail%>
 Password  <%=strPw%>


ご登録のメールアドレス宛に完了通知を送信しました。

<% }else{%>
エラー

 登録されたメールアドレスを確認して、もう一度試してください

<% }%>
Error[ <%=pgErr%> ]
<%=dbg%>