Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Bryan Kaperick
erp5
Commits
d8c5e5d2
Commit
d8c5e5d2
authored
Dec 28, 2017
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_monitoring] fix problem of changing password when current password is broken
parent
fa0c0c85
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
17 deletions
+64
-17
bt5/erp5_web_monitoring/PathTemplateItem/web_page_module/gadget_officejs_monitoring_opml_edit_js.js
...eb_page_module/gadget_officejs_monitoring_opml_edit_js.js
+51
-10
bt5/erp5_web_monitoring/PathTemplateItem/web_page_module/gadget_officejs_monitoring_opml_edit_js.xml
...b_page_module/gadget_officejs_monitoring_opml_edit_js.xml
+2
-2
bt5/erp5_web_monitoring/PathTemplateItem/web_page_module/monitoring_jio_storage_js.js
...TemplateItem/web_page_module/monitoring_jio_storage_js.js
+9
-3
bt5/erp5_web_monitoring/PathTemplateItem/web_page_module/monitoring_jio_storage_js.xml
...emplateItem/web_page_module/monitoring_jio_storage_js.xml
+2
-2
No files found.
bt5/erp5_web_monitoring/PathTemplateItem/web_page_module/gadget_officejs_monitoring_opml_edit_js.js
View file @
d8c5e5d2
/*global window, rJS, RSVP, btoa, XMLHttpRequest, Handlebars */
/*global window, rJS, RSVP, btoa, XMLHttpRequest, Handlebars
, jIO
*/
/*jslint nomen: true, indent: 2, maxerr: 3*/
(
function
(
window
,
rJS
,
RSVP
,
btoa
,
XMLHttpRequest
,
Handlebars
)
{
(
function
(
window
,
rJS
,
RSVP
,
btoa
,
XMLHttpRequest
,
Handlebars
,
jIO
)
{
"
use strict
"
;
var
gadget_klass
=
rJS
(
window
),
...
...
@@ -108,7 +108,7 @@
});
}
function
checkCredential
(
url
,
title
,
hash
)
{
function
checkCredential
(
url
,
title
,
hash
,
new_hash
)
{
// Verify if login and password are correct for this URL
if
(
url
===
undefined
)
{
return
{
status
:
'
OK
'
};
...
...
@@ -122,6 +122,17 @@
msg
:
error
.
msg
+
'
(
'
+
url
+
'
)
'
,
title
:
title
};
if
(
new_hash
!==
undefined
)
{
// saved password is not valid
// check if inputted password is valid
return
testUrl
(
url
,
new_hash
)
.
then
(
function
()
{
ko_msg
.
hash
=
new_hash
;
return
ko_msg
;
},
function
()
{
return
ko_msg
;
});
}
return
ko_msg
;
});
}
...
...
@@ -152,7 +163,8 @@
attachment_id
:
'
enclosure
'
,
parser
:
'
opml
'
,
sub_storage
:
{
type
:
"
http
"
type
:
"
http
"
,
timeout
:
25000
// timeout after 25 seconds
}
}
})
...
...
@@ -162,25 +174,40 @@
});
})
.
push
(
undefined
,
function
(
error
)
{
var
message_text
,
code
;
if
(
error
instanceof
jIO
.
util
.
jIOError
)
{
message_text
=
error
.
message
;
code
=
error
.
status_code
;
}
else
{
code
=
error
.
target
.
status
;
message_text
=
error
.
target
.
responseType
===
"
text
"
?
error
.
target
.
statusText
:
""
;
}
gadget
.
state
.
message
.
innerHTML
=
notify_msg_template
({
status
:
'
error
'
,
message
:
error
.
target
.
status
+
"
: Failed to access OPML URL.
"
+
error
.
message
message
:
code
+
"
: Failed to access OPML URL.
"
+
message_text
});
return
{
data
:
{
total_rows
:
0
}};
})
.
push
(
function
(
opml_result
)
{
var
i
,
check_list
=
[
true
];
check_list
=
[
true
],
new_login
;
if
(
opml_result
.
data
.
total_rows
>
0
)
{
opml_dict
.
title
=
opml_result
.
data
.
rows
[
0
].
value
.
title
;
if
(
doc
.
new_password
)
{
new_login
=
btoa
(
doc
.
username
+
'
:
'
+
doc
.
new_password
);
}
for
(
i
=
1
;
i
<
opml_result
.
data
.
total_rows
;
i
+=
1
)
{
if
(
opml_result
.
data
.
rows
[
i
].
value
.
url
!==
undefined
)
{
check_list
.
push
(
checkCredential
(
opml_result
.
data
.
rows
[
i
].
value
.
url
,
opml_result
.
data
.
rows
[
i
].
value
.
title
,
opml_dict
.
basic_login
opml_dict
.
basic_login
,
new_login
));
update_password_list
.
push
({
base_url
:
opml_result
.
data
.
rows
[
i
].
value
.
url
,
...
...
@@ -195,14 +222,28 @@
})
.
push
(
function
(
status_list
)
{
var
i
,
error_msg
=
''
;
error_msg
=
''
,
used_new_passwd_count
=
0
;
// in case the current password in opml is wrong and new
// password provided is OK, we set it as the current password in opml.
for
(
i
=
1
;
i
<
status_list
.
length
;
i
+=
1
)
{
if
(
status_list
[
i
].
status
!==
'
OK
'
)
{
if
(
status_list
[
i
].
hash
!==
undefined
)
{
used_new_passwd_count
+=
1
;
}
error_msg
+=
'
Login/password invalid for instance:
'
+
status_list
[
i
].
title
+
'
.
'
+
status_list
[
i
].
msg
+
'
\n
'
;
}
}
if
(
used_new_passwd_count
>
0
&&
used_new_passwd_count
===
(
status_list
.
length
-
1
))
{
// all backends password are OK, we only update our password
opml_dict
.
password
=
doc
.
new_password
;
doc
.
new_password
=
''
;
opml_dict
.
basic_login
=
status_list
[
1
].
hash
;
return
true
;
}
if
(
error_msg
!==
''
)
{
gadget
.
state
.
message
.
innerHTML
=
notify_msg_template
({
...
...
@@ -352,4 +393,4 @@
return
saveOPML
(
this
,
form_doc
,
verify_password
);
});
}(
window
,
rJS
,
RSVP
,
btoa
,
XMLHttpRequest
,
Handlebars
));
}(
window
,
rJS
,
RSVP
,
btoa
,
XMLHttpRequest
,
Handlebars
,
jIO
));
bt5/erp5_web_monitoring/PathTemplateItem/web_page_module/gadget_officejs_monitoring_opml_edit_js.xml
View file @
d8c5e5d2
...
...
@@ -242,7 +242,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
3.29541.62889.7577
</string>
</value>
<value>
<string>
96
4.28658.19106.46779
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>
151
0680916.21
</float>
<float>
151
4476756.65
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_monitoring/PathTemplateItem/web_page_module/monitoring_jio_storage_js.js
View file @
d8c5e5d2
...
...
@@ -38,10 +38,16 @@
}
function
createStorage
(
context
,
storage_spec
,
key
)
{
if
(
!
context
.
_remote_storage_dict
.
hasOwnProperty
(
key
))
{
context
.
_remote_storage_dict
[
key
]
=
jIO
.
createJIO
(
storage_spec
);
var
signature
;
signature
=
generateHash
(
JSON
.
stringify
(
storage_spec
));
if
(
!
context
.
_remote_storage_dict
.
hasOwnProperty
(
key
)
||
signature
!==
context
.
_remote_storage_dict
[
key
].
signature
)
{
context
.
_remote_storage_dict
[
key
]
=
{
storage
:
jIO
.
createJIO
(
storage_spec
),
signature
:
signature
};
}
return
context
.
_remote_storage_dict
[
key
];
return
context
.
_remote_storage_dict
[
key
]
.
storage
;
}
/**
...
...
bt5/erp5_web_monitoring/PathTemplateItem/web_page_module/monitoring_jio_storage_js.xml
View file @
d8c5e5d2
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
964.
6864.64042.3420
1
</string>
</value>
<value>
<string>
964.
7018.29631.5055
1
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
151
3173747.08
</float>
<float>
151
4476144.01
</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