Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eterfund-api-email
Project
Project
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eterfund
eterfund-api-email
Commits
091ecdca
Commit
091ecdca
authored
Jan 23, 2018
by
Дмитрий Никулин
Committed by
Vitaly Lipatov
Jan 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add manual checking method
parent
3ade3c1f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
2 deletions
+29
-2
svcCheckEmail.js
svcCheckEmail.js
+29
-2
No files found.
svcCheckEmail.js
View file @
091ecdca
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
FIELD_SUCCESS
=
'bg-true'
,
FIELD_SUCCESS
=
'bg-true'
,
FIELD_INVALID
=
'bg-false'
;
FIELD_INVALID
=
'bg-false'
;
var
EMAIL_REGEX
=
/^
([^
@
\s]
+
)
@
(([
a-zA-Z0-9
\_\-]
+
\.)
+
([
a-zA-Z
]{2}
|aero|arpa|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|post|pro|tel|travel|xxx
))
$/
;
var
EMAIL_REGEX
=
/^
([^
@
\s]
+
)
@
(([
a-zA-Z0-9
\_\-]
+
\.)
+
([
a-zA-Z
]{2}
|aero|arpa|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|post|pro|tel|travel|xxx
|events
))
$/
;
// TODO: избавиться от глобального состояния, лучше для каждой
// TODO: избавиться от глобального состояния, лучше для каждой
// формы иметь свой набор таких полей
// формы иметь свой набор таких полей
...
@@ -189,12 +189,13 @@
...
@@ -189,12 +189,13 @@
emailNotice
=
$
(
notice
);
emailNotice
=
$
(
notice
);
$
(
'body'
).
prepend
(
emailNotice
);
$
(
'body'
).
prepend
(
emailNotice
);
$
(
'#notice_close_btn'
).
click
(
closeNotice
);
}
}
$
(
'#notice_text'
).
html
(
message
);
$
(
'#notice_text'
).
html
(
message
);
emailNotice
.
removeClass
().
addClass
(
type
);
emailNotice
.
removeClass
().
addClass
(
type
);
$
(
'#notice_close_btn'
).
removeClass
().
addClass
(
type
)
.
click
(
closeNotice
)
;
$
(
'#notice_close_btn'
).
removeClass
().
addClass
(
type
);
lastNoticeType
=
type
;
lastNoticeType
=
type
;
lastNoticeMessage
=
message
;
lastNoticeMessage
=
message
;
...
@@ -230,6 +231,7 @@
...
@@ -230,6 +231,7 @@
modifyField
=
!
emailInput
.
hasClass
(
'svcCheckEmail-nostyle'
);
modifyField
=
!
emailInput
.
hasClass
(
'svcCheckEmail-nostyle'
);
var
emailNotice
,
emailForm
=
emailInput
.
closest
(
'form'
);
var
emailNotice
,
emailForm
=
emailInput
.
closest
(
'form'
);
if
(
!
emailForm
.
hasClass
(
'manual'
))
{
emailForm
.
submit
(
function
()
{
emailForm
.
submit
(
function
()
{
var
email
=
getEMail
();
var
email
=
getEMail
();
if
(
email
===
''
)
{
if
(
email
===
''
)
{
...
@@ -255,6 +257,31 @@
...
@@ -255,6 +257,31 @@
return
true
;
return
true
;
});
});
}
window
.
checkEmail
=
function
(
callback
)
{
var
email
=
getEMail
();
if
(
email
===
''
)
{
setStatus
(
STATUS_ERROR
,
getErrorMessage
(
ERROR_EMPTY
));
callback
(
false
);
return
;
}
if
(
status
===
STATUS_NONE
)
{
checkEmailFull
(
email
,
function
(
result
)
{
callback
(
result
);
});
return
;
}
if
(
status
!==
STATUS_SUCCESS
)
{
showSameNotice
();
callback
(
false
);
return
;
}
callback
(
true
);
};
emailInput
.
blur
(
function
()
{
emailInput
.
blur
(
function
()
{
var
email
=
getEMail
();
var
email
=
getEMail
();
...
...
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