diff --git a/interface/resources/qml/LoginDialog/LinkAccountBody.qml b/interface/resources/qml/LoginDialog/LinkAccountBody.qml index b975e3c443..5a89a04d78 100644 --- a/interface/resources/qml/LoginDialog/LinkAccountBody.qml +++ b/interface/resources/qml/LoginDialog/LinkAccountBody.qml @@ -282,6 +282,7 @@ Item { } placeholderText: "Username or Email" activeFocusOnPress: true + prohibitedCharacters: ["\n"]; Keys.onPressed: { switch (event.key) { case Qt.Key_Tab: @@ -315,6 +316,7 @@ Item { styleRenderType: Text.QtRendering placeholderText: "Password" activeFocusOnPress: true + prohibitedCharacters: ["\n"]; echoMode: passwordFieldMouseArea.showPassword ? TextInput.Normal : TextInput.Password anchors { top: emailField.bottom diff --git a/interface/resources/qml/controlsUit/TextField.qml b/interface/resources/qml/controlsUit/TextField.qml index 1d47126cd1..86707395e3 100644 --- a/interface/resources/qml/controlsUit/TextField.qml +++ b/interface/resources/qml/controlsUit/TextField.qml @@ -32,6 +32,7 @@ TextField { property string leftPermanentGlyph: ""; property string centerPlaceholderGlyph: ""; property int styleRenderType: Text.NativeRendering + property var prohibitedCharacters: [""]; placeholderText: textField.placeholderText @@ -179,4 +180,15 @@ TextField { anchors.bottomMargin: 3 visible: label != "" } + + onTextChanged: { + removeProhibitedCharacters(); + } + + function removeProhibitedCharacters() { + var pattern = prohibitedCharacters.join(''); + var regex = new RegExp('[' + pattern + ']', 'g'); + + text = text.replace(regex, ''); + } }