fixed EDU-408 Error when trying to upload course to stepic with incorrect credentials

This commit is contained in:
Ekaterina Tuzova
2015-08-25 11:42:42 +03:00
parent 33749f8eb6
commit bb47a8b817
2 changed files with 10 additions and 5 deletions
@@ -132,6 +132,7 @@ public class EduStepicConnector {
}
catch (UnsupportedEncodingException e) {
LOG.error(e.getMessage());
ourClient = null;
return false;
}
@@ -144,11 +145,13 @@ public class EduStepicConnector {
final StatusLine line = response.getStatusLine();
if (line.getStatusCode() != 302) {
LOG.error("Failed to login " + EntityUtils.toString(response.getEntity()));
ourClient = null;
return false;
}
}
catch (IOException e) {
LOG.error(e.getMessage());
LOG.warn(e.getMessage());
ourClient = null;
return false;
}
return true;
@@ -39,13 +39,15 @@ public class LoginDialog extends DialogWrapper {
@Override
protected void doOKAction() {
AuthDataHolder authData = myLoginPanel.getAuthData();
StudySettings.getInstance().setLogin(authData.email);
StudySettings.getInstance().setPassword(authData.password);
final boolean success = EduStepicConnector.login(authData.email, authData.password);
if (!success) {
setErrorText("Log in failed");
setErrorText("Login failed");
}
else {
StudySettings.getInstance().setLogin(authData.email);
StudySettings.getInstance().setPassword(authData.password);
super.doOKAction();
}
super.doOKAction();
}
public void clearErrors() {