Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Matevz Golob
wendelin
Commits
7a1f0f98
Commit
7a1f0f98
authored
Jul 17, 2019
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show message from server side user credential request creation script.
parent
e88809ef
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
5 deletions
+82
-5
bt5/erp5_wendelin_data_lake_ui/PathTemplateItem/web_page_module/fif_gadget_erp5_register_html.html
...teItem/web_page_module/fif_gadget_erp5_register_html.html
+1
-0
bt5/erp5_wendelin_data_lake_ui/PathTemplateItem/web_page_module/fif_gadget_erp5_register_html.xml
...ateItem/web_page_module/fif_gadget_erp5_register_html.xml
+2
-2
bt5/erp5_wendelin_data_lake_ui/PathTemplateItem/web_page_module/fif_gadget_erp5_register_js.rst
...plateItem/web_page_module/fif_gadget_erp5_register_js.rst
+76
-0
bt5/erp5_wendelin_data_lake_ui/PathTemplateItem/web_page_module/fif_gadget_erp5_register_js.xml
...plateItem/web_page_module/fif_gadget_erp5_register_js.xml
+3
-3
No files found.
bt5/erp5_wendelin_data_lake_ui/PathTemplateItem/web_page_module/fif_gadget_erp5_register_html.html
View file @
7a1f0f98
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
...
...
bt5/erp5_wendelin_data_lake_ui/PathTemplateItem/web_page_module/fif_gadget_erp5_register_html.xml
View file @
7a1f0f98
...
...
@@ -232,7 +232,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
976.541
47.54917.10649
</string>
</value>
<value>
<string>
976.541
50.62060.20974
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>
156
2150816.8
</float>
<float>
156
3275707.24
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_wendelin_data_lake_ui/PathTemplateItem/web_page_module/fif_gadget_erp5_register_js.
js
→
bt5/erp5_wendelin_data_lake_ui/PathTemplateItem/web_page_module/fif_gadget_erp5_register_js.
rst
View file @
7a1f0f98
/*global window, rJS,
UriTemplat
e */
/*global window, rJS,
RSVP, jIO, UriTemplate, document, consol
e */
/*jslint indent: 2, maxerr: 3, nomen: true */
(
function
(
window
,
rJS
,
UriTemplate
,
document
)
{
(function (window, rJS,
RSVP, jIO, UriTemplate, document, console
) {
"use strict";
function validateEmail(email) {
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());
}
rJS(window)
/////////////////////////////////////////////////////////////////
// handle acquisition
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("redirect", "redirect")
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
)
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("updateHeader", "updateHeader")
...
...
@@ -18,8 +21,12 @@
// declared methods
/////////////////////////////////////////////////////////////////
//.declareMethod("render", function (options) {
//})
.onEvent('submit', function (evt) {
var
first_name
=
document
.
getElementById
(
"
first_name
"
).
value
,
var gadget = this,
first_name = document.getElementById("first_name").value,
last_name = document.getElementById("last_name").value,
email = document.getElementById("email").value;
...
...
@@ -27,24 +34,43 @@
document.getElementById("status-message").innerHTML = msg;
}
function
validateEmail
(
email
)
{
var
re
=
/^
(([^
<>()
\[\]\\
.,;:
\s
@"
]
+
(\.[^
<>()
\[\]\\
.,;:
\s
@"
]
+
)
*
)
|
(
".+"
))
@
((\[[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\])
|
(([
a-zA-Z
\-
0-9
]
+
\.)
+
[
a-zA-Z
]{2,}))
$/
;
return
re
.
test
(
String
(
email
).
toLowerCase
());
}
if ((validateEmail(email)) && (first_name) && (last_name)) {
/* send to server */
var url = "ERP5Site_newCredentialRequest?batch_mode=1&reference=" + email + "&default_email_text=" + email + "&first_name=" + first_name + "&last_name=" + last_name;
jIO
.
util
.
ajax
({
"
type
"
:
"
POST
"
,
return RSVP.Queue()
.push(function () {
return jIO.util.ajax({"type": "POST",
"url": url,
"
xhrFields
"
:
{
withCredentials
:
true
}})
// XXX: check server response code!
showMessage
(
"
Request was created and will be reviewed shortly. It might take some time to be approved. You will be notified by email.
"
);
"xhrFields": {withCredentials: true}});
})
.push(function (server_response) {
var response = server_response.target.response;
var r = JSON.parse(response),
msg = r.msg,
code = r.code;
if (code === 0) {
return gadget.notifySubmitted({message: msg, status: 'success'});
}
else {
return gadget.notifySubmitted({message: msg, status: 'error'});
}
}, function (error) {
return gadget.notifySubmitted({message: 'HTTP ERROR. Registration NOT done.', status: 'error'});
})
//if you want to redirect to a specific page after registration:
/*.push(function () {
return gadget.redirect({
command: 'display',
options: {
page: "home"
}
});
})*/;
} else {
showMessage
(
"
Invalid first or last name or invalid email address!
"
);
return gadget.notifySubmitted({message: 'bad fields', status: 'error'}
);
}
return
evt
;
});
}(
window
,
rJS
,
UriTemplate
,
document
));
\ No newline at end of file
}(window, rJS, RSVP, jIO, UriTemplate, document, console));
\ No newline at end of file
bt5/erp5_wendelin_data_lake_ui/PathTemplateItem/web_page_module/fif_gadget_erp5_register_js.xml
View file @
7a1f0f98
...
...
@@ -69,7 +69,7 @@
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/
javascrip
t
</string>
</value>
<value>
<string>
text/
x-rs
t
</string>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
...
...
@@ -232,7 +232,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
97
6.54162.42888.10752
</string>
</value>
<value>
<string>
97
7.8898.22031.4078
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>
156
2151577.76
</float>
<float>
156
3367884.02
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
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