mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-23 19:21:59 +03:00
re-asking for password if previous upload failed
This commit is contained in:
@ -1665,24 +1665,27 @@ public class Sketch {
|
|||||||
|
|
||||||
Uploader uploader = new UploaderFactory().newUploader(target.getBoards().get(board), Preferences.get("serial.port"));
|
Uploader uploader = new UploaderFactory().newUploader(target.getBoards().get(board), Preferences.get("serial.port"));
|
||||||
|
|
||||||
if (uploader.requiresAuthorization() && !Preferences.has(uploader.getAuthorizationKey())) {
|
boolean success = false;
|
||||||
PasswordAuthorizationDialog dialog = new PasswordAuthorizationDialog(editor);
|
do {
|
||||||
dialog.setLocationRelativeTo(editor);
|
if (uploader.requiresAuthorization() && !Preferences.has(uploader.getAuthorizationKey())) {
|
||||||
dialog.setVisible(true);
|
PasswordAuthorizationDialog dialog = new PasswordAuthorizationDialog(editor);
|
||||||
|
dialog.setLocationRelativeTo(editor);
|
||||||
|
dialog.setVisible(true);
|
||||||
|
|
||||||
if (dialog.isCancelled()) {
|
if (dialog.isCancelled()) {
|
||||||
editor.statusNotice(_("Upload cancelled"));
|
editor.statusNotice(_("Upload cancelled"));
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Preferences.set(uploader.getAuthorizationKey(), DigestUtils.sha512Hex(dialog.getPassword()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Preferences.set(uploader.getAuthorizationKey(), DigestUtils.sha512Hex(dialog.getPassword()));
|
success = uploader.uploadUsingPreferences(buildPath, suggestedClassName, usingProgrammer);
|
||||||
}
|
|
||||||
|
|
||||||
boolean success = uploader.uploadUsingPreferences(buildPath, suggestedClassName, usingProgrammer);
|
if (uploader.requiresAuthorization() && !success) {
|
||||||
|
Preferences.remove(uploader.getAuthorizationKey());
|
||||||
if (uploader.requiresAuthorization() && !success) {
|
}
|
||||||
Preferences.remove(uploader.getAuthorizationKey());
|
} while (uploader.requiresAuthorization() && !success);
|
||||||
}
|
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user