• R/O
  • HTTP
  • SSH
  • HTTPS

karesansui: Commit

Git repository of Karesansui.


Commit MetaInfo

Revision0e0376cd9fb5e8fb9b95a5302b5628d7389b8eb7 (tree)
Time2011-06-17 18:27:27
AuthorJunichi Shinohara <junichi@kare...>
CommiterJunichi Shinohara

Log Message

Bug fix for mail address validation. not used +.

Change Summary

Incremental Difference

--- a/karesansui/lib/checker.py
+++ b/karesansui/lib/checker.py
@@ -570,13 +570,10 @@ class Checker(object):
570570 if value and ret_val:
571571 if check & CHECK_VALID:
572572
573- regex = "^(?P<localpart>[^@]+)@(?P<domainpart>.+)?$"
573+ regex = "^[-a-zA-Z0-9!"#$%&'()*+/:;<=>?[\]^_`{|}~.]+@[-a-zA-Z0-9_.]+$"
574574 m = re.compile(regex).search(value)
575575 if m:
576- tstr1 = m.group("localpart")
577- tstr2 = m.group("domainpart")
578- ret_val = ret_val and self.check_username_with_num(name, tstr1, check, 1, 64)
579- ret_val = ret_val and self.check_domainname(_('Domain name part of %s') % (name,), tstr2, CHECK_EMPTY|check, 4, 255, domain)
576+ ret_val = True
580577 else:
581578 ret_val = False
582579 self.add_error(_('%s is in an invalid format.') % (name,))
--- a/karesansui/templates/default/data/js/checker.js
+++ b/karesansui/templates/default/data/js/checker.js
@@ -1,6 +1,6 @@
11 // This file is part of Karesansui Core.
22 //
3-// Copyright (C) 2009-2010 HDE, Inc.
3+// Copyright (C) 2009-2011 HDE, Inc.
44 //
55 // This program is free software; you can redistribute it and/or
66 // modify it under the terms of the GNU Lesser General Public
@@ -638,18 +638,9 @@ function check_mailaddress(form, check, name, domain, min, max){
638638
639639 if(form.value && ret_val){
640640 if(check & CHECK_VALID){
641- var treg = /^([^@]+)@(.+)?$/;
641+ var treg = /^[-a-zA-Z0-9!"#$%&'()*+/:;<=>?[\]^_`{|}~.]+@[-a-zA-Z0-9_.]+$/;
642642 if(form.value.match(treg)){
643- var tstr1 = RegExp.$1;
644- var tstr2 = RegExp.$2;
645- var formval = form.value;
646- form.value = tstr1;
647- ret_val = ret_val && check_username_with_num(form, check, name);
648- form.value = formval;
649- formval = form.value;
650- form.value = tstr2;
651- ret_val = ret_val && check_domainname(form, CHECK_EMPTY | check, minisprintf("${_('Domain name part of %s')}",name),domain);
652- form.value = formval;
643+ ret_val = true;
653644 }else{
654645 ERROR_MSG += minisprintf("${_('%s is invalid format.')}",name);
655646 ERROR_MSG += "\n";
Show on old repository browser