examples/installer: Pre-fill username from full name
This might help some users, let's see if this is desirable or not...
@@ -12,6 +12,7 @@ module GUI
add_text("User name\nThis is the login username.")
@username_input = add_textarea()
+ @username_edited = false
add_text("Password and confirmation")
@password_input = add_textarea()
@@ -40,6 +41,19 @@ module GUI
end
end
+ @username_input.on_modified = ->(value) do
+ validate_step()
+ @username_edited = true
+ end
+
+ @fullname_input.on_modified = ->(value) do
+ validate_step()
+ unless @username_edited then
+ username = value.deburr.downcase.gsub(/ /, ".").gsub(/[^a-z0-9-.]/, "-")
+ @username_input.set_text(username)
+ end
+ end
+
# TODO: Back to list of steps?
self.back_location = MainWindow.instance
end
