Skip to content

Commit 0cd8225

Browse files
authored
Fixing control issues in authviews. (#406)
* Fixing control issues in authviews.
1 parent f05ca34 commit 0cd8225

File tree

4 files changed

+39
-23
lines changed

4 files changed

+39
-23
lines changed

uitools/import/Esri/ArcGISRuntime/Toolkit/ClientCertificateView.qml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ Dialog {
3535

3636
footer: DialogButtonBox {
3737
Button {
38-
id: bBox
3938
text: qsTr("Skip")
4039
DialogButtonBox.buttonRole: DialogButtonBox.RejectRole
4140
}

uitools/import/Esri/ArcGISRuntime/Toolkit/Controller/AuthenticationController.qml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,28 +105,38 @@ QtObject {
105105
}
106106

107107
function continueWithUsernamePassword(...args) {
108-
internal.currentChallenge.continueWithUsernamePassword(...args);
109-
internal.currentChallenge = null;
108+
if (internal.currentChallenge) {
109+
internal.currentChallenge.continueWithUsernamePassword(...args);
110+
internal.currentChallenge = null;
111+
}
110112
}
111113

112114
function continueWithOAuthAuthorizationCode(...args) {
113-
internal.currentChallenge.continueWithOAuthAuthorizationCode(...args);
114-
internal.currentChallenge = null;
115+
if (internal.currentChallenge) {
116+
internal.currentChallenge.continueWithOAuthAuthorizationCode(...args);
117+
internal.currentChallenge = null;
118+
}
115119
}
116120

117121
function continueWithClientCertificate(...args) {
118-
internal.currentChallenge.continueWithClientCertificate(...args);
119-
internal.currentChallenge = null;
122+
if (internal.currentChallenge) {
123+
internal.currentChallenge.continueWithClientCertificate(...args);
124+
internal.currentChallenge = null;
125+
}
120126
}
121127

122128
function continueWithSslHandshake(...args) {
123-
internal.currentChallenge.continueWithSslHandshake(...args);
124-
internal.currentChallenge = null;
129+
if (internal.currentChallenge) {
130+
internal.currentChallenge.continueWithSslHandshake(...args);
131+
internal.currentChallenge = null;
132+
}
125133
}
126134

127135
function cancel(...args) {
128-
internal.currentChallenge.cancel(...args);
129-
internal.currentChallenge = null;
136+
if (internal.currentChallenge) {
137+
internal.currentChallenge.cancel(...args);
138+
internal.currentChallenge = null;
139+
}
130140
}
131141

132142
property QtObject internal: QtObject {

uitools/import/Esri/ArcGISRuntime/Toolkit/OAuth2View.qml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@ Dialog {
6262
if (title.indexOf("SUCCESS code=") > -1) {
6363
var authCode = title.replace("SUCCESS code=", "");
6464
controller.continueWithOAuthAuthorizationCode(authCode);
65-
oAuthView.accept();
6665
} else if (title.indexOf("Denied error=") > -1) {
67-
oAuthView.reject();
66+
controller.cancel();
6867
}
6968
}
7069
}

uitools/import/Esri/ArcGISRuntime/Toolkit/UserCredentialsView.qml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ Dialog {
3737

3838
footer: DialogButtonBox {
3939
Button {
40-
id: bBox
4140
text: qsTr("Skip")
4241
DialogButtonBox.buttonRole: DialogButtonBox.RejectRole
4342
}
@@ -46,15 +45,14 @@ Dialog {
4645
text: qsTr("Continue")
4746
DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
4847
}
49-
}
5048

51-
onAccepted: {
52-
controller.continueWithUsernamePassword(usernameTextField.text,
53-
passwordTextField.text);
54-
}
49+
onAccepted: {
50+
acceptWithCurrentUsernameAndPassword();
51+
}
5552

56-
onRejected: {
57-
controller.cancel();
53+
onRejected: {
54+
controller.cancel();
55+
}
5856
}
5957

6058
ColumnLayout {
@@ -91,18 +89,28 @@ Dialog {
9189
TextField {
9290
id: usernameTextField
9391
placeholderText: qsTr("username")
94-
onAccepted: userCredentialsView.accept();
92+
onAccepted: acceptWithCurrentUsernameAndPassword()
9593
Layout.fillWidth: true
9694
Layout.margins: 5
9795
}
9896

9997
TextField {
10098
id: passwordTextField
10199
placeholderText: qsTr("password")
102-
onAccepted: userCredentialsView.accept();
100+
onAccepted: acceptWithCurrentUsernameAndPassword()
103101
echoMode: TextInput.Password
104102
Layout.fillWidth: true
105103
Layout.margins: 5
106104
}
107105
}
106+
107+
/*!
108+
\internal
109+
\brief Attempts to apply the current username and password to
110+
the token.
111+
*/
112+
function acceptWithCurrentUsernameAndPassword() {
113+
controller.continueWithUsernamePassword(usernameTextField.text,
114+
passwordTextField.text);
115+
}
108116
}

0 commit comments

Comments
 (0)