2023-08-24 15:50:37 +08:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import QtQuick.Window
|
|
|
|
import QtQuick.Controls
|
|
|
|
import FluentUI
|
2024-01-25 17:26:50 +08:00
|
|
|
import "../component"
|
2023-08-24 15:50:37 +08:00
|
|
|
|
|
|
|
FluScrollablePage{
|
|
|
|
|
2024-03-09 15:35:48 +08:00
|
|
|
title: qsTr("Captcha")
|
2023-08-24 15:50:37 +08:00
|
|
|
|
|
|
|
FluCaptcha{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: captcha
|
2023-08-24 15:50:37 +08:00
|
|
|
Layout.topMargin: 20
|
2023-09-13 15:11:22 +08:00
|
|
|
ignoreCase:switch_case.checked
|
2023-08-24 15:50:37 +08:00
|
|
|
MouseArea{
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onClicked: {
|
|
|
|
captcha.refresh()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FluButton{
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Refresh")
|
2023-08-24 15:50:37 +08:00
|
|
|
Layout.topMargin: 20
|
|
|
|
onClicked: {
|
|
|
|
captcha.refresh()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-13 15:11:22 +08:00
|
|
|
FluToggleSwitch{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: switch_case
|
|
|
|
text: qsTr("Ignore Case")
|
2023-09-13 15:11:22 +08:00
|
|
|
checked: true
|
|
|
|
Layout.topMargin: 10
|
|
|
|
}
|
|
|
|
|
2023-08-24 15:50:37 +08:00
|
|
|
RowLayout{
|
|
|
|
spacing: 10
|
|
|
|
Layout.topMargin: 10
|
|
|
|
FluTextBox{
|
|
|
|
id:text_box
|
2024-03-09 15:35:48 +08:00
|
|
|
placeholderText: qsTr("Please enter a verification code")
|
2023-11-24 22:05:53 +08:00
|
|
|
Layout.preferredWidth: 240
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
FluButton{
|
|
|
|
text:"verify"
|
|
|
|
onClicked: {
|
|
|
|
var success = captcha.verify(text_box.text)
|
|
|
|
if(success){
|
2024-03-09 15:35:48 +08:00
|
|
|
showSuccess(qsTr("The verification code is correct"))
|
2023-08-24 15:50:37 +08:00
|
|
|
}else{
|
2024-03-09 15:35:48 +08:00
|
|
|
showError(qsTr("Error validation, please re-enter"))
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|