Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
check
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_web
check
Commits
a5359e8b
Commit
a5359e8b
authored
Oct 12, 2022
by
Kang Donghun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
バリデーションJS追加
parent
a2495381
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
161 additions
and
161 deletions
+161
-161
abvw/common/js/common.js
+0
-161
abvw/common/js/validation.js
+160
-0
abvw/html/login.html
+1
-0
No files found.
abvw/common/js/common.js
View file @
a5359e8b
...
...
@@ -1306,164 +1306,4 @@ COMMON.callCmsApi = function(url, accountPath, apiName, type, params, async, suc
}
});
};
/*
* String utilities [ end ]
*/
// =============================================================================================
// Utils for string, date, number [ end ]
// =============================================================================================
var
ValidationUtil
=
{
// 必須: Text
CheckRequiredForText
:
function
(
value
)
{
if
(
value
==
null
||
value
==
''
)
{
return
false
;
}
return
true
;
},
// get byte count
GetByteCount
:
function
(
value
)
{
var
escapedStr
=
encodeURI
(
value
);
if
(
escapedStr
.
indexOf
(
"%"
)
!=
-
1
)
{
var
count
=
escapedStr
.
split
(
"%"
).
length
-
1
;
if
(
count
==
0
)
count
++
;
// perverse case; can't happen with real UTF-8
var
tmp
=
escapedStr
.
length
-
(
count
*
3
);
count
=
count
+
tmp
;
}
else
{
count
=
escapedStr
.
length
;
}
return
count
;
},
// 最小文字数
CheckMinLengthForByte
:
function
(
value
,
len
)
{
if
(
this
.
GetByteCount
(
value
)
<
len
)
return
false
;
return
true
;
},
// 最大文字数
CheckMaxLengthForByte
:
function
(
value
,
len
)
{
if
(
this
.
GetByteCount
(
value
)
>
len
)
return
false
;
return
true
;
},
// 半数字
IsNumber
:
function
(
value
)
{
var
reg
=
new
RegExp
(
"^[0-9]+$"
);
return
reg
.
test
(
value
);
},
// 半英字
IsAlphabet
:
function
(
value
)
{
var
reg
=
new
RegExp
(
"^[a-zA-Z]+$"
);
return
reg
.
test
(
value
);
},
// 半記号
IsSymbol
:
function
(
value
)
{
var
reg
=
new
RegExp
(
"
\
u005b
\
u005e
\
u0027
\
u0060
\
u0027
\
u007e
\
u0027
\
u0021
\
u0027
\
u0040
\
u0027
\
u0023
\
u0027
\
u0024
\
u0027
\
u0025
\
u0027
\
u005e
\
u0027
\
u0026
\
u0027
\
u002a
\
u0027
\
u0028
\
u0027
\
u0029
\
u0027
\
u005f
\
u0027
\
u002b
\
u0027
\
u003d
\
u0027
\
u007b
\
u0027
\
u007d
\
u0027
\
u007c
\
u0027
\
u003a
\
u0027
\
u0022
\
u0027
\
u003b
\
u0027
\
u0027
\
u0027
\
u003c
\
u0027
\
u003e
\
u0027
\
u003f
\
u0027
\
u002f
\
u0027
\
u002e
\
u0027
\
u002c
\
u005c
\
u002d
\
u005b
\
u005c
\
u005d
\
u005c
\
u005c
\
u005d"
);
return
!
reg
.
test
(
value
);
},
// メール
CheckEmailValid
:
function
(
value
)
{
// Check if string is a valid email address
var
reg
=
new
RegExp
(
"^[0-9a-zA-Z]+@[0-9a-zA-Z]+[
\\
.]{1}[0-9a-zA-Z]+[
\\
.]?[0-9a-zA-Z]+$"
);
return
reg
.
test
(
value
);
},
// Password
CheckPasswordValid
:
function
(
value
)
{
// Check if string is a valid email address
var
reg
=
new
RegExp
(
"^(?=.*
\
d)(?=.*[a-z])(?=.*[A-Z])(?=.*[#+-
\\
./:_]).{1,47}$"
);
return
reg
.
test
(
value
);
},
// Alphabet + Nunber + Symbol
IsAlphabetOrNumberOrSymbol
:
function
(
value
)
{
// Check if string is alphabet or number or symbol
var
reg
=
new
RegExp
(
"
\
u005b
\
u005e
\
u0061
\
u002d
\
u007a
\
u0041
\
u002d
\
u005a
\
u0030
\
u002d
\
u0039
\
u0027
\
u0060
\
u0027
\
u007e
\
u0027
\
u0021
\
u0027
\
u0040
\
u0027
\
u0023
\
u0027
\
u0024
\
u0027
\
u0025
\
u0027
\
u005e
\
u0027
\
u0026
\
u0027
\
u002a
\
u0027
\
u0028
\
u0027
\
u0029
\
u0027
\
u005f
\
u0027
\
u002b
\
u0027
\
u003d
\
u0027
\
u007b
\
u0027
\
u007d
\
u0027
\
u007c
\
u0027
\
u003a
\
u0027
\
u0022
\
u0027
\
u003b
\
u0027
\
u0027
\
u0027
\
u003c
\
u0027
\
u003e
\
u0027
\
u003f
\
u0027
\
u002f
\
u0027
\
u002e
\
u0027
\
u002c
\
u005c
\
u002d
\
u005b
\
u005c
\
u005d
\
u005c
\
u005c
\
u005d"
);
return
!
reg
.
test
(
value
);
},
// Get the total of types in array
CheckNumberOfTypeInString
:
function
(
value
)
{
var
list
=
new
Array
();
var
c
;
for
(
var
i
=
0
;
i
<
value
.
length
;
i
++
)
{
c
=
value
[
i
];
for
(
var
j
=
i
+
1
;
j
<
value
.
length
;
j
++
)
{
if
(
value
[
j
]
==
c
)
{
value
=
value
.
slice
(
0
,
j
)
+
value
.
slice
(
j
+
1
,
value
.
len
);
j
=
j
-
1
;
}
}
list
[
i
]
=
c
;
}
var
count
=
list
.
length
;
return
count
},
// Special character: *
IsCharacterSpecial
:
function
(
value
)
{
for
(
var
i
=
0
;
i
<
value
.
length
;
i
++
)
{
if
(
value
[
i
]
==
'*'
)
return
true
;
}
return
false
;
},
// 半記号
IsPasswordSymbol
:
function
(
value
)
{
var
reg
=
new
RegExp
(
"
\
u005b
\
u005e
\
u0027
\
u0023
\
u0027
\
u002b
\
u005c
\
u002d
\
u0027
\
u002e
\
u0027
\
u002f
\
u0027
\
u003a
\
u0027
\
u005f
\
u005d"
);
return
!
reg
.
test
(
value
);
},
// 半記号
IsPasswordAlphabetOrNumerOrSymbol
:
function
(
value
)
{
var
reg
=
new
RegExp
(
"
\
u005b
\
u005e
\
u0061
\
u002d
\
u007a
\
u0041
\
u002d
\
u005a
\
u0030
\
u002d
\
u0039
\
u0027
\
u0023
\
u0027
\
u002b
\
u005c
\
u002d
\
u0027
\
u002e
\
u0027
\
u002f
\
u0027
\
u003a
\
u0027
\
u005f
\
u005d"
);
return
!
reg
.
test
(
value
);
},
HasSeqChar
:
function
(
value
,
num
)
{
var
count
=
0
;
var
prev
=
0
;
for
(
var
i
=
0
;
i
<
str
.
length
();
i
++
)
{
var
c
=
str
.
charAt
(
i
);
if
(
i
>
0
&&
prev
==
c
)
{
count
++
;
if
(
count
==
num
-
1
)
{
return
true
;
}
}
else
{
count
=
0
;
}
prev
=
c
;
}
return
false
;
},
ContainSameSeqChar
:
function
(
str1
,
str2
,
num
)
{
if
(
str2
.
length
<
num
||
str1
.
length
<
num
)
{
return
false
;
}
for
(
var
i
=
0
;
i
<=
str2
.
length
-
num
;
i
++
)
{
var
target
=
str2
.
substring
(
i
,
i
+
num
);
if
(
str1
.
contains
(
target
))
{
return
true
;
}
}
return
false
;
}
};
\ No newline at end of file
abvw/common/js/validation.js
0 → 100644
View file @
a5359e8b
/*
* String utilities [ end ]
*/
// =============================================================================================
// Utils for string, date, number [ end ]
// =============================================================================================
var
ValidationUtil
=
{
// 必須: Text
CheckRequiredForText
:
function
(
value
)
{
if
(
value
==
null
||
value
==
''
)
{
return
false
;
}
return
true
;
},
// get byte count
GetByteCount
:
function
(
value
)
{
var
escapedStr
=
encodeURI
(
value
);
if
(
escapedStr
.
indexOf
(
"%"
)
!=
-
1
)
{
var
count
=
escapedStr
.
split
(
"%"
).
length
-
1
;
if
(
count
==
0
)
count
++
;
// perverse case; can't happen with real UTF-8
var
tmp
=
escapedStr
.
length
-
(
count
*
3
);
count
=
count
+
tmp
;
}
else
{
count
=
escapedStr
.
length
;
}
return
count
;
},
// 最小文字数
CheckMinLengthForByte
:
function
(
value
,
len
)
{
if
(
this
.
GetByteCount
(
value
)
<
len
)
return
false
;
return
true
;
},
// 最大文字数
CheckMaxLengthForByte
:
function
(
value
,
len
)
{
if
(
this
.
GetByteCount
(
value
)
>
len
)
return
false
;
return
true
;
},
// 半数字
IsNumber
:
function
(
value
)
{
var
reg
=
new
RegExp
(
"^[0-9]+$"
);
return
reg
.
test
(
value
);
},
// 半英字
IsAlphabet
:
function
(
value
)
{
var
reg
=
new
RegExp
(
"^[a-zA-Z]+$"
);
return
reg
.
test
(
value
);
},
// 半記号
IsSymbol
:
function
(
value
)
{
var
reg
=
new
RegExp
(
"
\
u005b
\
u005e
\
u0027
\
u0060
\
u0027
\
u007e
\
u0027
\
u0021
\
u0027
\
u0040
\
u0027
\
u0023
\
u0027
\
u0024
\
u0027
\
u0025
\
u0027
\
u005e
\
u0027
\
u0026
\
u0027
\
u002a
\
u0027
\
u0028
\
u0027
\
u0029
\
u0027
\
u005f
\
u0027
\
u002b
\
u0027
\
u003d
\
u0027
\
u007b
\
u0027
\
u007d
\
u0027
\
u007c
\
u0027
\
u003a
\
u0027
\
u0022
\
u0027
\
u003b
\
u0027
\
u0027
\
u0027
\
u003c
\
u0027
\
u003e
\
u0027
\
u003f
\
u0027
\
u002f
\
u0027
\
u002e
\
u0027
\
u002c
\
u005c
\
u002d
\
u005b
\
u005c
\
u005d
\
u005c
\
u005c
\
u005d"
);
return
!
reg
.
test
(
value
);
},
// メール
CheckEmailValid
:
function
(
value
)
{
// Check if string is a valid email address
var
reg
=
new
RegExp
(
"^[0-9a-zA-Z]+@[0-9a-zA-Z]+[
\\
.]{1}[0-9a-zA-Z]+[
\\
.]?[0-9a-zA-Z]+$"
);
return
reg
.
test
(
value
);
},
// Password
CheckPasswordValid
:
function
(
value
)
{
// Check if string is a valid email address
var
reg
=
new
RegExp
(
"^(?=.*
\
d)(?=.*[a-z])(?=.*[A-Z])(?=.*[#+-
\\
./:_]).{1,47}$"
);
return
reg
.
test
(
value
);
},
// Alphabet + Nunber + Symbol
IsAlphabetOrNumberOrSymbol
:
function
(
value
)
{
// Check if string is alphabet or number or symbol
var
reg
=
new
RegExp
(
"
\
u005b
\
u005e
\
u0061
\
u002d
\
u007a
\
u0041
\
u002d
\
u005a
\
u0030
\
u002d
\
u0039
\
u0027
\
u0060
\
u0027
\
u007e
\
u0027
\
u0021
\
u0027
\
u0040
\
u0027
\
u0023
\
u0027
\
u0024
\
u0027
\
u0025
\
u0027
\
u005e
\
u0027
\
u0026
\
u0027
\
u002a
\
u0027
\
u0028
\
u0027
\
u0029
\
u0027
\
u005f
\
u0027
\
u002b
\
u0027
\
u003d
\
u0027
\
u007b
\
u0027
\
u007d
\
u0027
\
u007c
\
u0027
\
u003a
\
u0027
\
u0022
\
u0027
\
u003b
\
u0027
\
u0027
\
u0027
\
u003c
\
u0027
\
u003e
\
u0027
\
u003f
\
u0027
\
u002f
\
u0027
\
u002e
\
u0027
\
u002c
\
u005c
\
u002d
\
u005b
\
u005c
\
u005d
\
u005c
\
u005c
\
u005d"
);
return
!
reg
.
test
(
value
);
},
// Get the total of types in array
CheckNumberOfTypeInString
:
function
(
value
)
{
var
list
=
new
Array
();
var
c
;
for
(
var
i
=
0
;
i
<
value
.
length
;
i
++
)
{
c
=
value
[
i
];
for
(
var
j
=
i
+
1
;
j
<
value
.
length
;
j
++
)
{
if
(
value
[
j
]
==
c
)
{
value
=
value
.
slice
(
0
,
j
)
+
value
.
slice
(
j
+
1
,
value
.
len
);
j
=
j
-
1
;
}
}
list
[
i
]
=
c
;
}
var
count
=
list
.
length
;
return
count
},
// Special character: *
IsCharacterSpecial
:
function
(
value
)
{
for
(
var
i
=
0
;
i
<
value
.
length
;
i
++
)
{
if
(
value
[
i
]
==
'*'
)
return
true
;
}
return
false
;
},
// 半記号
IsPasswordSymbol
:
function
(
value
)
{
var
reg
=
new
RegExp
(
"
\
u005b
\
u005e
\
u0027
\
u0023
\
u0027
\
u002b
\
u005c
\
u002d
\
u0027
\
u002e
\
u0027
\
u002f
\
u0027
\
u003a
\
u0027
\
u005f
\
u005d"
);
return
!
reg
.
test
(
value
);
},
// 半記号
IsPasswordAlphabetOrNumerOrSymbol
:
function
(
value
)
{
var
reg
=
new
RegExp
(
"
\
u005b
\
u005e
\
u0061
\
u002d
\
u007a
\
u0041
\
u002d
\
u005a
\
u0030
\
u002d
\
u0039
\
u0027
\
u0023
\
u0027
\
u002b
\
u005c
\
u002d
\
u0027
\
u002e
\
u0027
\
u002f
\
u0027
\
u003a
\
u0027
\
u005f
\
u005d"
);
return
!
reg
.
test
(
value
);
},
HasSeqChar
:
function
(
value
,
num
)
{
var
count
=
0
;
var
prev
=
0
;
for
(
var
i
=
0
;
i
<
str
.
length
();
i
++
)
{
var
c
=
str
.
charAt
(
i
);
if
(
i
>
0
&&
prev
==
c
)
{
count
++
;
if
(
count
==
num
-
1
)
{
return
true
;
}
}
else
{
count
=
0
;
}
prev
=
c
;
}
return
false
;
},
ContainSameSeqChar
:
function
(
str1
,
str2
,
num
)
{
if
(
str2
.
length
<
num
||
str1
.
length
<
num
)
{
return
false
;
}
for
(
var
i
=
0
;
i
<=
str2
.
length
-
num
;
i
++
)
{
var
target
=
str2
.
substring
(
i
,
i
+
num
);
if
(
str1
.
contains
(
target
))
{
return
true
;
}
}
return
false
;
}
};
\ No newline at end of file
abvw/html/login.html
View file @
a5359e8b
...
...
@@ -22,6 +22,7 @@
<script
type=
"text/javascript"
src=
"/abvw/common/js/jquery/jquery-ui.min.js?__UPDATEID__"
></script>
<script
type=
"text/javascript"
src=
"/abvw/common/js/web/i18n.js?__UPDATEID__"
></script>
<script
type=
"text/javascript"
src=
"/abvw/common/js/constant.js?__UPDATEID__"
></script>
<script
type=
"text/javascript"
src=
"/abvw/common/js/validation.js?__UPDATEID__"
></script>
<script
type=
"text/javascript"
src=
"/abvw/common/js/common.js?__UPDATEID__"
></script>
<script
type=
"text/javascript"
src=
"/abvw/js/login/login.js?__UPDATEID__"
></script>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment