mirror of
https://github.com/YunoHost/SSOwat.git
synced 2024-09-03 20:06:27 +02:00
Merge pull request #32 from jeromelebleu/unstable
Consider new gTLDs in email regex using Lrexlib
This commit is contained in:
commit
5cc42fdcd2
2 changed files with 5 additions and 5 deletions
2
debian/control
vendored
2
debian/control
vendored
|
@ -7,7 +7,7 @@ Standards-Version: 3.9.1
|
||||||
|
|
||||||
Package: ssowat
|
Package: ssowat
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Depends: yunohost-config-nginx, lua-ldap, lua-json
|
Depends: yunohost-config-nginx, lua-ldap, lua-json, lua-rex-pcre
|
||||||
Homepage: http://www.yunohost.org
|
Homepage: http://www.yunohost.org
|
||||||
Description: SSOWAT
|
Description: SSOWAT
|
||||||
Websso for yunohost
|
Websso for yunohost
|
||||||
|
|
|
@ -591,8 +591,8 @@ function edit_user ()
|
||||||
end
|
end
|
||||||
ldap:close()
|
ldap:close()
|
||||||
|
|
||||||
-- TODO: updates to support the new TLDs?
|
local rex = require "rex_pcre"
|
||||||
local mail_pattern = "[A-Za-z0-9%.%%%+%-]+@[A-Za-z0-9%.%%%+%-]+%.%w%w%w?%w?"
|
local mail_re = rex.new([[^[\w\.\-]+@([^\W_A-Z]+([\-]*[^\W_A-Z]+)*\.)+([^\W\d_]{2,})$]], rex.flags().UTF8)
|
||||||
|
|
||||||
local mails = {}
|
local mails = {}
|
||||||
|
|
||||||
|
@ -605,7 +605,7 @@ function edit_user ()
|
||||||
for k, mail in ipairs(mailalias) do
|
for k, mail in ipairs(mailalias) do
|
||||||
if mail ~= "" then
|
if mail ~= "" then
|
||||||
-- Check the mail pattern
|
-- Check the mail pattern
|
||||||
if not mail:match(mail_pattern) then
|
if not mail_re:match(mail) then
|
||||||
flash("fail", t("invalid_mail")..": "..mail)
|
flash("fail", t("invalid_mail")..": "..mail)
|
||||||
return redirect(conf.portal_url.."edit.html")
|
return redirect(conf.portal_url.."edit.html")
|
||||||
|
|
||||||
|
@ -638,7 +638,7 @@ function edit_user ()
|
||||||
local drops = {}
|
local drops = {}
|
||||||
for k, mail in ipairs(maildrop) do
|
for k, mail in ipairs(maildrop) do
|
||||||
if mail ~= "" then
|
if mail ~= "" then
|
||||||
if not mail:match(mail_pattern) then
|
if not mail_re:match(mail) then
|
||||||
flash("fail", t("invalid_mailforward")..": "..mail)
|
flash("fail", t("invalid_mailforward")..": "..mail)
|
||||||
return redirect(conf.portal_url.."edit.html")
|
return redirect(conf.portal_url.."edit.html")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue