1 | try {↵ | | 1 | try {↵
|
2 | // AUTH↵ | | 2 | // AUTH↵
|
3 | protocol.auth(AuthenticationManager↵ | | 3 | protocol.authenticate(AuthenticationManager↵
|
4 | .getSaslName(loginMethod), popItem.get("user"),↵ | | 4 | .getSaslName(loginMethod), item.get("user"),↵
|
5 | password);↵ | | 5 | password);↵
|
|
6 | login↵ | | 6 | // If no exception happened we have successfully logged↵
|
| | | 7 | // in↵
|
7 | = true;↵ | | 8 | authenticated = true;↵
|
8 | } catch (AuthenticationException e) {↵ | | 9 | } catch (AuthenticationException e) {↵
|
9 | // If the cause is a IMAPExcpetion then only password↵ | | 10 | // If the cause is a IMAPExcpetion then only password↵
|
10 | // wrong↵ | | 11 | // wrong↵
|
11 | // else bogus authentication mechanism↵ | | 12 | // else bogus authentication mechanism↵
|
12 | if (e.getCause() instanceof POP3Exception)↵ | | 13 | if (e.getCause() instanceof IMAPException)↵
|
13 | throw (POP3Exception) e.getCause();↵ | | 14 | throw (IMAPException) e.getCause();↵
|
|
14 | // Some error in the client/server communication↵ | | 15 | // Some error in the client/server communication↵
|
15 | // --> fall back to default login process↵ | | 16 | // --> fall back to default login process↵
|
16 | int result = JOptionPane↵ | | 17 | int result = JOptionPane↵
|
17 | .showConfirmDialog(↵ | | 18 | .showConfirmDialog(↵
|
18 | FrameManager.getInstance()↵ | | 19 | FrameManager.getInstance()↵
|
19 | .getActiveFrame(),↵ | | 20 | .getActiveFrame(),↵
|
20 | new MultiLineLabel(↵ | | 21 | new MultiLineLabel(↵
|
21 | e.getMessage()↵ | | 22 | e.getMessage()↵
|
22 | + "\n"↵ | | 23 | + "\n"↵
|
23 | + MailResourceLoader↵ | | 24 | + MailResourceLoader↵
|
24 | .getString(↵ | | 25 | .getString(↵
|
25 | "dialog",↵ | | 26 | "dialog",↵
|
26 | "error",↵ | | 27 | "error",↵
|
27 | "authentication_fallback_to_default")),↵ | | 28 | "authentication_fallback_to_default")),↵
|
28 | MailResourceLoader.getString("dialog",↵ | | 29 | MailResourceLoader.getString("dialog",↵
|
29 | "error",↵ | | 30 | "error",↵
|
30 | "authentication_process_error"),↵ | | 31 | "authentication_process_error"),↵
|
31 | JOptionPane.OK_CANCEL_OPTION);↵ | | 32 | JOptionPane.OK_CANCEL_OPTION);↵
|
|
32 | if (result == JOptionPane.OK_OPTION) {↵ | | 33 | if (result == JOptionPane.OK_OPTION) {↵
|
33 | loginMethod = AuthenticationManager.USER;↵ | | 34 | loginMethod = AuthenticationManager.LOGIN;↵
|
34 | popItem.setString("login_method", Integer↵ | | 35 | item.setString("login_method", Integer↵
|
35 | .toString(loginMethod));↵ | | 36 | .toString(loginMethod));↵
|
36 | } else {↵ | | 37 | } else {↵
|
37 | throw new CommandCancelledException();↵ | | 38 | throw new CommandCancelledException();↵
|
38 | }↵ | | 39 | }↵
|
39 | } | | 40 | }
|