diff src/login.html.luan @ 29:a1db5223ced1

luan changes
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 25 Jul 2022 21:28:10 -0600
parents 7d0c96408abf
children 260abd8f8565
line wrap: on
line diff
--- a/src/login.html.luan	Thu Jul 21 23:44:49 2022 -0600
+++ b/src/login.html.luan	Mon Jul 25 21:28:10 2022 -0600
@@ -2,7 +2,7 @@
 local error = Luan.error
 local String = require "luan:String.luan"
 local trim = String.trim or error()
-local matches = String.matches or error()
+local regex = String.regex or error()
 local Html = require "luan:Html.luan"
 local url_encode = Html.url_encode or error()
 local Io = require "luan:Io.luan"
@@ -21,6 +21,8 @@
 local run_in_transaction = Db.run_in_transaction or error()
 
 
+local name_regex = regex "^[a-zA-Z0-9_-]+$"
+
 local function get_user(email,password)
 	local user = User.get_by_email(email)
 	user or error "email not found"
@@ -116,7 +118,7 @@
 		end
 	else
 		name = trim(name)
-		matches( name, "^[a-zA-Z0-9_-]+$" ) or error "invalid name"
+		name_regex.matches(name) or error "invalid name"
 		local error_message = nil
 		local user
 		run_in_transaction( function()