如何驗證電子郵件(Yahoo,Gmail,Hotmail和AOL)的用戶名和密碼? 哪裏應該把認真的auth電子郵件?Java - 如何驗證用戶名和密碼
這是我的代碼
public class AuthMail
{
public static void authEmail()
{
if(LoginDialog.t_Email.getText().isEmpty())
{
Util.printErrorMessage("Plase Enter an Email Address");
JOptionPane.showMessageDialog(null, "Plase Enter an Email Address", "Error", JOptionPane.ERROR_MESSAGE);
}
else if(LoginDialog.p_Password.getText().isEmpty())
{
System.out.println("Plase Enter Your Password");
JOptionPane.showMessageDialog(null, "Plase Enter Your Password", "Error", JOptionPane.ERROR_MESSAGE);
}
else if(Util.getMailType().equals("GMail"))
{
System.out.println("Logging...");
System.out.println("Attempting connection to GMail...");
}
else if(Util.getMailType().equals("Yahoo"))
{
System.out.println("Logging...");
System.out.println("Attempting connection to Yahoo...");
}
else if(Util.getMailType().equals("Yahoo"))
{
System.out.println("Logging...");
System.out.println("Attempting connection to Hotmail...");
}
else if(Util.getMailType().equals("AOL"))
{
System.out.println("Logging...");
System.out.println("Attempting connection to Aol...");
}
else if(Util.getMailType().equals("Unknown"))
{
System.out.println("Mail Type Unknown");
int var1 = JOptionPane.showConfirmDialog(null, "Email Type Unknown. Did you want to try again?", "Error", JOptionPane.YES_NO_OPTION);
if(var1 == JOptionPane.NO_OPTION)
{
System.exit(0);
}
}
}
}
注:Util.class是由自己創造。
一件事,你需要JInputDialog框而不是JMessageDialog來請求輸入。 – 2013-03-02 03:48:05
@lonnez No.我使用帶有JTextField和JPasswordField的JPanel的JFrame – 2013-03-02 03:50:21
你基本上想要檢查用戶是否輸入了正確的用戶名和密碼。 – kaysush 2013-03-02 03:53:19