Select to view content in your preferred language

Check Portal signIn status

1591
3
10-28-2016 03:03 AM
AntonioFiume
Deactivated User

Dear All,

is possible to check the signIn status in the portal?

A lot of example uses the default Dialog Box for the login.

I created a custom qml for the login.

How is it possible to check if the login are going successfully or not?

 

import QtQuick 2.3
import QtQuick.Controls 2.0
import Esri.ArcGISRuntime 100.0
ApplicationWindow {
    id: appWindow
    width: 800
    height: 600
    title: "TestMapQtNEW"
    Frame {
        id: frmLogin
        x: 203
        y: 200
        width: 394
        height: 200
        anchors.verticalCenter: parent.verticalCenter
        anchors.horizontalCenterOffset: 0
        anchors.horizontalCenter: parent.horizontalCenter
        opacity: 1
        clip: false
        Label {
            id: lblPassword
            x: 53
            y: 80
            text: qsTr("Password:")
        }
        Label {
            id: lblUsername
            x: 53
            y: 49
            text: qsTr("Username:")
        }
        TextField {
            id: txtPassword
            x: 132
            y: 74
            placeholderText: qsTr("Text Field")
        }
        TextField {
            id: txtUsername
            x: 132
            y: 43
            placeholderText: qsTr("Text Field")
        }
        
        Portal {
            id: myPortal
            url: "http://www.arcgis.com"
        }
        Button {
            id: btnLogin
            x: 232
            y: 125
            text: qsTr("Login")
            onClicked: {
                
                var credential = ArcGISRuntimeEnvironment.createObject("Credential", {username:txtUsername.text, password:txtPassword.text});
                myPortal.credential = credential;
                myPortal.signIn();
                //AND NOW? HOW I CAN CHECK THE STATUS AND/OR THE ERROR?
            }
        }
    }
    // add a mapView component
}
0 Kudos
3 Replies
EricBader
Honored Contributor

There is an onSignInError signal you can handle.

There's also a property called signedIn, which tells you if the user is signed in or not.

Are these helpful?

AntonioFiume
Deactivated User

Hi Eric and thanks for the reply.

The Portal Object don't have obSignInError. Please note that i using the ArcGIS SDK for QT Quartz Beta:

This are the list of Properties, Signals and Methods:

I tried to check the Bool SignedIn but the result is ever FALSE.

Could you please take a look?

0 Kudos
AntonioFiume
Deactivated User

Dear Eric,

sorry for my second reply.

seems that this solution could be solve my problem.

Could you please take a look?

 onSignInStatusChanged:
            {
                switch (portal1.signInStatus)
                {
                    case 1:
                        break;
                    case 2:
                        txtError.text = "Login Success";
                        break;
                    case 3:
                        txtError.text = "Login ERROR";
                        break;
                    default:
                        break;
                }
            }
0 Kudos