diff src/get_password.html.luan @ 21:b14073ab9d07

update luan
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 14 Sep 2024 22:17:26 -0600
parents a6e72cd199f1
children
line wrap: on
line diff
--- a/src/get_password.html.luan	Mon Aug 05 11:32:22 2024 +0300
+++ b/src/get_password.html.luan	Sat Sep 14 22:17:26 2024 -0600
@@ -1,7 +1,6 @@
 local Luan = require "luan:Luan.luan"
 local error = Luan.error
 local String = require "luan:String.luan"
-local matches = String.matches or error()
 local Io = require "luan:Io.luan"
 local output_of = Io.output_of or error()
 local Http = require "luan:http/Http.luan"
@@ -16,9 +15,10 @@
 
 
 local send_mail = config.mail_info and Mail.sender(config.mail_info).send
+local email_regex = String.regex[[^(\w[-+~.\w]*)@[-\w]+(\\.[-\w]+)*\.[a-zA-Z]+$]]
 
 local function handle(email)
-	matches( email, [[^(\w[-+~.\w]*)@[-\w]+(\\.[-\w]+)*\.[a-zA-Z]+$]] ) or error "invalid email"
+	email_regex.matches(email) or error "invalid email"
 	local change = Http.request.parameters.change ~= nil
 	local password = config.users[email]
 	if password == nil or change then