import QtQuick 2.0
import Ubuntu.Components 1.1
import Ubuntu.Components.Popups 0.1
Item {
id: ssoOAuthDialog
property alias dialogComponent: component
function signOnAttempt(email, pass, otp) {
dlgloading = true;
py.call('...', [email, pass, otp], function(response) {
if(response.code == 500) {
//...
}
else if(response.code == 200) {
PopupUtils.close(dialogComponent.dlg);
} else {
// ...
}
});
}
Component {
id: component
Dialog {
id: dlg
objectName: "dialog"
modal: true // Screen behind the dialog will be greyed-out
title: "Login credentials for login.ubuntu.com"
Label {
id: errorMessage
}
TextField {
id: emailBox
// ...
}
TextField {
id: passwordBox
// ...
}
TextField {
id: otpBox
// ...
}
Button {
text: i18n.tr("Ok")
objectName: "okButton"
onClicked: {
signOnAttempt(emailBox.text, passwordBox.text, otpBox.text);
}
}
Button {
text: i18n.tr("Cancel")
objectName: "cancelButton"
onClicked: {
PopupUtils.close(dlg);
cancelClicked();
}
}
Component.onCompleted: {
emailBox.forceActiveFocus();
}
Component.onDestruction: {
emailBox.text = "";
passwordBox.text = "";
otpBox.text = "";
}
}
}
}