Commit f6c4fd95 authored by Dirk Steinkopf's avatar Dirk Steinkopf

trim username

parent 76eca295
......@@ -66,7 +66,7 @@ class Backend {
void registerUser(final String username, final String pin, final String installationId,
activityHandler(bool isActive), completionHandler(bool hasBeenSaved, String info)) {
final urlParam = "registerUser?username=${Uri.encodeComponent(username)}";
final urlParam = "registerUser?username=${Uri.encodeComponent(username.trim())}";
final bodyData = {'pin': pin, 'installationId': installationId};
_bgCall("registerUser", urlParam, bodyData, activityHandler, (String result, String error) {
debugPrint("registerUser completion");
......
......@@ -76,18 +76,18 @@ Diese App dient lediglich zu Informations- und Weiterbildungszwecken. Sie ist ni
autocorrect: false,
decoration: new InputDecoration(
hintText: "Config-Link",
),
),
controller: _configLinkController,
onChanged: _onChangedConfigLink,
),
),
),
//
// Username
new ListTile(
leading: const Icon(Icons.person),
trailing: _registered && !_modifiedSomething ? const Icon(Icons.check) : const Icon(Icons.notifications),
title: new TextField(
autofocus: _configured && !_registered, // does not work :-(
autofocus: _configured && !_registered, // does not work :-(
keyboardType: TextInputType.text,
decoration: new InputDecoration(
hintText: "Name",
......@@ -224,7 +224,7 @@ Diese App dient lediglich zu Informations- und Weiterbildungszwecken. Sie ist ni
void _saveUserValues(UserRegistration userRegistration, {bool registered}) {
// username/Pin remain in the app - even if registration failed
userRegistration.username = _nameController.text;
userRegistration.username = _nameController.text.trim();
userRegistration.pin = _pinController.text;
userRegistration.registered = registered;
}
......@@ -238,8 +238,10 @@ Diese App dient lediglich zu Informations- und Weiterbildungszwecken. Sie ist ni
UserRegistration.getInstance().then((UserRegistration userRegistration) {
userRegistration.installationId.then((String installationId) {
Backend.getInstance().registerUser(_nameController.text, _pinController.text, installationId, activityHandler,
(bool hasBeenSaved, String info) {
Backend
.getInstance()
.registerUser(_nameController.text, _pinController.text.trim(), installationId, activityHandler,
(bool hasBeenSaved, String info) {
_saveUserValues(userRegistration, registered: hasBeenSaved);
if (hasBeenSaved) {
_enableDisableSaveButton();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment