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