Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit c73da14

Browse files
committed
Merge remote-tracking branch 'origin/develop' into develop
2 parents b990c87 + 87cd3dd commit c73da14

File tree

2 files changed

+27
-32
lines changed

2 files changed

+27
-32
lines changed

core/src/plugins/authfront.otp/class.OTP_LoginForm.js

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,33 @@ Class.create("OTP_LoginForm", {
2424
},
2525
observer: function(){
2626
// string
27-
var otpEnabled = '<span id="add_otp_notion" style=" font-size: 16px;"> * OTP enabled</span>';
27+
var enableModifyGUI = pydio.getPluginConfigs("authfront.otp").get("MODIFY_LOGIN_SCREEN");
28+
if(enableModifyGUI){
29+
var f= modal.getForm();
2830

29-
var obj_loginform = $("login_form");
30-
if(!obj_loginform.down(("#add_otp_notion"))){
31-
obj_loginform.insert({bottom:otpEnabled});
31+
if(!f.down('input[name="otp_code"]')){
32+
try{
33+
var el = f.down('input[name="password"]').up("div.SF_element");
34+
var clone = el.cloneNode(true);
35+
el.insert({after:clone});
36+
var newField = clone.down('input[name="password"]');
37+
newField.writeAttribute('name', 'otp_code');
38+
newField.writeAttribute('data-ajxpLoginAdditionalParameter', 'true');
39+
clone.down('div.SF_label').update('Unique Code (6 digits)');
40+
}catch(e){
41+
if(console) console.log('Error while replacing OTP field', e);
42+
}}
43+
}
44+
else{
45+
var f= modal.getForm();
46+
if(f.down('input[name="otp_code"]')){
47+
f.remove(f.down('input[name="otp_code"]'));
48+
}
49+
var otpEnabled = '<span id="add_otp_notion" style=" font-size: 16px;"> * OTP enabled</span>';
50+
if(!f.down(("#add_otp_notion"))){
51+
f.insert({bottom:otpEnabled});
52+
}
3253
}
3354
}
3455
});
35-
var enableModifyGUI = pydio.getPluginConfigs("authfront.otp").get("MODIFY_LOGIN_SCREEN");
36-
if(!enableModifyGUI){
37-
window.OTPFORM = new OTP_LoginForm();
38-
}
56+
window.OTPFORM = new OTP_LoginForm();

core/src/plugins/authfront.otp/manifest.xml

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,7 @@
3131
<external_file filename="plugins/core.auth/standard_auth_actions.xml" include="actions/*" exclude=""/>
3232
<client_configs>
3333
<template element="ajxp_desktop" name="otp_script" position="bottom"><![CDATA[
34-
<script>
35-
document.observe("ajaxplorer:afterApply-login", function(){
36-
var f= modal.getForm();
37-
38-
var enableModifyGUI = ajaxplorer.getPluginConfigs("authfront.otp")._object.MODIFY_LOGIN_SCREEN;
39-
40-
if(!enableModifyGUI) return;
41-
42-
if(f.down('input[name="otp_code"]')){
43-
return;
44-
}
45-
try{
46-
var el = f.down('input[name="password"]').up("div.SF_element");
47-
var clone = el.cloneNode(true);
48-
el.insert({after:clone});
49-
var newField = clone.down('input[name="password"]');
50-
newField.writeAttribute('name', 'otp_code');
51-
newField.writeAttribute('data-ajxpLoginAdditionalParameter', 'true');
52-
clone.down('div.SF_label').update('Unique Code (6 digits)');
53-
}catch(e){
54-
if(console) console.log('Error while replacing OTP field', e);
55-
}
56-
});
57-
</script>
34+
<script></script>
5835
]]></template>
5936
</client_configs>
6037
</registry_contributions>

0 commit comments

Comments
 (0)