|
@@ -9,22 +9,102 @@
|
|
|
<script type="text/javascript" src="../../script/semantic/semantic.min.js"></script>
|
|
|
<script type="text/javascript" src="../../script/ao_module.js"></script>
|
|
|
<style>
|
|
|
-
|
|
|
+
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
|
|
<div class="ui container">
|
|
|
-
|
|
|
+ <h3 class="ui header" style="padding-top: 12px;">
|
|
|
+ <img src="img/lock.svg">
|
|
|
+ <div class="content">
|
|
|
+ <span id="title">Authentication Required</span>
|
|
|
+ <div id="desc" class="sub header">in order to proceed this operation</div>
|
|
|
+ </div>
|
|
|
+ </h3>
|
|
|
+ <p>Username</p>
|
|
|
+ <div class="ui small fluid input" style="margin-top: -10px;">
|
|
|
+ <input id="username" type="text" placeholder="">
|
|
|
+ </div>
|
|
|
+ <p>Password</p>
|
|
|
+ <div class="ui fluid input" style="margin-top: -10px;">
|
|
|
+ <input id="password" type="password" placeholder="">
|
|
|
+ </div>
|
|
|
+ <br>
|
|
|
+ <div align="right">
|
|
|
+ <button class="ui green button" onclick="confirm()">OK</button>
|
|
|
+ <button class="ui button" onclick="cancel()">Cancel</button>
|
|
|
+ </div>
|
|
|
+
|
|
|
</div>
|
|
|
|
|
|
<script>
|
|
|
+ ao_module_setFixedWindowSize();
|
|
|
var actionObject = {};
|
|
|
+ var method = "GET";
|
|
|
if (window.location.hash.length > 1){
|
|
|
var object = JSON.parse(decodeURIComponent(window.location.hash.substr(1)));
|
|
|
console.log(object);
|
|
|
+
|
|
|
+ if (typeof(object.title) != "undefined"){
|
|
|
+ $("#title").html(object.title);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (typeof(object.desc) != "undefined"){
|
|
|
+ $("#desc").html(object.desc);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (typeof(object.thisuser) != "undefined" && object.thisuser == true){
|
|
|
+ //Load user info from server side
|
|
|
+ $.get("../../system/desktop/user", function(data){
|
|
|
+ $("#username").val(data.Username);
|
|
|
+ $("#username").attr("readonly","true");
|
|
|
+ $("#username").parent().addClass("disabled");
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (typeof(object.method) != "undefined" && object.method != ""){
|
|
|
+ method = object.method;
|
|
|
+ }
|
|
|
+
|
|
|
+ actionObject = object;
|
|
|
}else{
|
|
|
//Invalid usage
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ function confirm(){
|
|
|
+ $("password").parent().removeClass("error");
|
|
|
+ var payload = actionObject.data;
|
|
|
+ //Append custom payload to the original payload
|
|
|
+ payload.username = $("#username").val();
|
|
|
+ payload.password = $("#password").val();
|
|
|
+ //Request endpoint
|
|
|
+ $.ajax({
|
|
|
+ url: "../../" + actionObject.api,
|
|
|
+ data: data,
|
|
|
+ method: method,
|
|
|
+ success: function(data){
|
|
|
+ if (data.error != undefined){
|
|
|
+ $("#password").parent().addClass("error");
|
|
|
+ }else{
|
|
|
+ if (ao_module_hasParentCallback()){
|
|
|
+ ao_module_parentCallback(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ ao_module_close();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ function cancel(){
|
|
|
+ if (ao_module_hasParentCallback()){
|
|
|
+ ao_module_parentCallback(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ ao_module_close();
|
|
|
+ }
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|