summaryrefslogtreecommitdiff
path: root/gui/qml/LoginDialog.qml
blob: 8e28d59c2832c762488eef5da9b3e8d891b5c60a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import QtQuick 2.0
import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.4

Dialog {
    title: qsTr("Login")
    standardButtons: Dialog.Ok

    Column {
        anchors.fill: parent
        Text {
            text: getLoginText()
            font.bold: true
        }
        Text {
            text: getDetailedText()
        }
        TextField {
            id: username
            placeholderText: qsTr("patron id")
        }
        TextField {
            id: password
            placeholderText: qsTr("password")
            echoMode: TextInput.PasswordEchoOnEdit
            visible: !allowEmptyPass
        }
    }

    onAccepted: backend.login(username.text, password.text)
    onRejected: backend.quit()

    function getLoginText() {
        if (allowEmptyPass) {
            return qsTr("Enter your Patron ID")
        } else {
            return qsTr("Log in with your library credentials")
        }
    }

    function getDetailedText() {
        return qsTr("You can check your Patron ID number in the back of your library card")
    }
}