diff src/set_name.html.luan @ 56:7ce54f6d93f2

add change name
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 28 Nov 2022 22:00:43 -0700
parents 260abd8f8565
children
line wrap: on
line diff
--- a/src/set_name.html.luan	Mon Nov 28 20:33:47 2022 -0700
+++ b/src/set_name.html.luan	Mon Nov 28 22:00:43 2022 -0700
@@ -2,7 +2,6 @@
 local error = Luan.error
 local String = require "luan:String.luan"
 local trim = String.trim or error()
-local regex = String.regex or error()
 local Io = require "luan:Io.luan"
 local Http = require "luan:http/Http.luan"
 local Shared = require "site:/lib/Shared.luan"
@@ -12,12 +11,11 @@
 local Forum = require "site:/lib/Forum.luan"
 local forum_title = Forum.title or error()
 local User = require "site:/lib/User.luan"
+local name_regex = User.name_regex
 local Db = require "site:/lib/Db.luan"
 local run_in_transaction = Db.run_in_transaction or error()
 
 
-local name_regex = regex "^[a-zA-Z0-9_-]+$"
-
 local function page(contents)
 	Io.stdout = Http.response.text_writer()
 %>
@@ -80,7 +78,7 @@
 				<input type="hidden" name="password" value="<%= user.password %>" >
 				<label>User name for <%= user.email %></label>
 				<input type="text" name="name" value="<%= name or "" %>" autofocus required pattern="[a-zA-Z0-9_-]+">
-				<input type="submit" value="Set">
+				<input type="submit">
 			</form>
 <%
 	end)