|
@@ -1,188 +1,188 @@
|
|
|
-<!DOCTYPE HTML>
|
|
|
-<html>
|
|
|
- <head>
|
|
|
- <meta charset="UTF-8">
|
|
|
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
|
- <title>ArozOS - Users</title>
|
|
|
- <link rel="stylesheet" href="script/semantic/semantic.min.css">
|
|
|
- <link rel="stylesheet" href="script/ao.css">
|
|
|
- <script type="application/javascript" src="script/semantic/semantic.min.js"></script>
|
|
|
- <script type="application/javascript" src="script/jquery.min.js"></script>
|
|
|
- <script type="application/javascript" src="script/ao_module.js"></script>
|
|
|
- <style>
|
|
|
- body{
|
|
|
- background-color:white;
|
|
|
- }
|
|
|
- .themebackground{
|
|
|
- background-color:#588ce0 !important;
|
|
|
- color:white !important;
|
|
|
- background-image: url("/img/public/slate.png") !important;
|
|
|
- background-repeat: no-repeat !important;
|
|
|
- background-attachment: fixed !important;
|
|
|
- }
|
|
|
-
|
|
|
- .ui.padded.slate{
|
|
|
- width: 100%;
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- padding: 4em;
|
|
|
- }
|
|
|
-
|
|
|
- .ui.heading.slate{
|
|
|
- align-items: flex-start;
|
|
|
- }
|
|
|
-
|
|
|
- .ts.slate .header:not(.ts):not(.sub):not(.item){
|
|
|
- line-height: 1.42857em;
|
|
|
- font-weight: 500;
|
|
|
- display: block;
|
|
|
- }
|
|
|
-
|
|
|
- .required{
|
|
|
- color:red;
|
|
|
- }
|
|
|
- .actionbtns{
|
|
|
- text-align:right;
|
|
|
- }
|
|
|
- </style>
|
|
|
- </head>
|
|
|
- <body>
|
|
|
- <div class="ui heading fluid padded slate themebackground" >
|
|
|
- <span class="header" style="font-size: 1.6em;"><i class="add icon"></i> New User</span>
|
|
|
- <span class="description">Fill in the following user information to proceed.</span>
|
|
|
- </div>
|
|
|
- <br><br>
|
|
|
- <div class="ui container">
|
|
|
- <div class="ui horizontal form">
|
|
|
- <div class="field">
|
|
|
- <label>Username <span class="required">*</span></label>
|
|
|
- <input id="username" type="text">
|
|
|
- </div>
|
|
|
- <!--
|
|
|
- <div class="field">
|
|
|
- <label>Description</label>
|
|
|
- <input id="desc" type="text">
|
|
|
- </div>
|
|
|
- -->
|
|
|
- <div class="field">
|
|
|
- <label>Password <span class="required">*</span></label>
|
|
|
- <input id="magic" type="password">
|
|
|
- </div>
|
|
|
- <div class="field">
|
|
|
- <label>Confirm Password <span class="required">*</span></label>
|
|
|
- <input id="repeatMagic" type="password">
|
|
|
- </div>
|
|
|
- <div class="field">
|
|
|
- <label>User Group</label>
|
|
|
- <select id="usergroups">
|
|
|
- <option>Loading...</option>
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <br>
|
|
|
- <p><span class="required">*</span> This field is required.</p>
|
|
|
- <div class="ui negative segment" id="err" style="display:none;">
|
|
|
- <p><i class="remove icon"></i> <span id="errmsg"></span></p>
|
|
|
- </div>
|
|
|
- <div class="ui section divider"></div>
|
|
|
- <div id="actionbtns" align="right">
|
|
|
- <button class="ui primary button" onclick="createUser();">Create</button>
|
|
|
- <button id="cancelbtn" class="ui button" onclick="cancel();">Cancel</button>
|
|
|
- </div>
|
|
|
-
|
|
|
- </div>
|
|
|
- <script>
|
|
|
- //Initiate the form items
|
|
|
- //Get usergroups and list them in the usergroup list
|
|
|
- $.get("system/permission/listgroup",function(data){
|
|
|
- $("#usergroups").html("");
|
|
|
- for(var i = 0; i < data.length; i++){
|
|
|
- $("#usergroups").append(`<option>${data[i]}</option>`);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- //Detect on enter keypress
|
|
|
- $("input").on("keydown",function(event){
|
|
|
- if (event.keyCode === 13) {
|
|
|
- event.preventDefault();
|
|
|
- createUser();
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- //Hide the cancel button if not in VDI
|
|
|
- if ((!(!parent.isDesktopMode)) == false){
|
|
|
- $("#cancelbtn").hide();
|
|
|
- }
|
|
|
-
|
|
|
- //Create the new user
|
|
|
- function createUser(){
|
|
|
- var username = $("#username").val();
|
|
|
- var password = $("#magic").val();
|
|
|
- var usergroup = $("#usergroups").val();
|
|
|
- var valud = true;
|
|
|
- //Clear previous error record
|
|
|
- $("#magic").parent().removeClass("error");
|
|
|
- $("#repeatMagic").parent().removeClass("error");
|
|
|
- $("#username").parent().removeClass("error");
|
|
|
-
|
|
|
- //Check if the username is correct
|
|
|
- if (username == ""){
|
|
|
- $("#username").parent().addClass("error");
|
|
|
- valud = false;
|
|
|
- }
|
|
|
- //Check if the password match with the confirm
|
|
|
- if (password != $("#repeatMagic").val()){
|
|
|
- //Confirm password not match
|
|
|
- $("#repeatMagic").parent().addClass("error");
|
|
|
- valud = false;
|
|
|
- }
|
|
|
- if (password == ""){
|
|
|
- //Password cannot be empty
|
|
|
- $("#magic").parent().addClass("error");
|
|
|
- $("#repeatMagic").parent().addClass("error");
|
|
|
- valud = false;
|
|
|
- }
|
|
|
-
|
|
|
- if (!valud){
|
|
|
- //Current input is invalid.
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- //Create post reqest for user registering
|
|
|
- $.post("system/auth/register",{username: username, password: password, group:usergroup}).done(function(data){
|
|
|
- console.log(data);
|
|
|
- if (data.includes("Error") == false){
|
|
|
- //Everyhing is ok
|
|
|
- //Check if user already logged in. If no, redirect to login interface
|
|
|
- $.get("system/auth/checkLogin",function(data){
|
|
|
- if (data == true){
|
|
|
- if (!(!parent.isDesktopMode)){
|
|
|
- //Perform a parent callback to check if there are any functions that requires update
|
|
|
- ao_module_parentCallback(true);
|
|
|
- parent.closeFwProcess($(window.frameElement).parent().parent().attr("windowId"));
|
|
|
- }else{
|
|
|
- //Tell the user to close this UI
|
|
|
- window.location.href = "SystemAO/closeTabInsturction.html"
|
|
|
- }
|
|
|
- }else{
|
|
|
- window.location.href = "/login.system";
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- }else{
|
|
|
- //There are errors.
|
|
|
- $("#errmsg").text(data);
|
|
|
- $("#err").slideDown('fast');
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- function cancel(){
|
|
|
- if (!(!parent.isDesktopMode)){
|
|
|
- parent.closeFwProcess($(window.frameElement).parent().parent().attr("windowId"));
|
|
|
- }
|
|
|
- }
|
|
|
- </script>
|
|
|
- </body>
|
|
|
-</html>
|
|
|
-
|
|
|
+<!DOCTYPE HTML>
|
|
|
+<html>
|
|
|
+ <head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
|
+ <title>ArozOS - Users</title>
|
|
|
+ <link rel="stylesheet" href="script/semantic/semantic.min.css">
|
|
|
+ <link rel="stylesheet" href="script/ao.css">
|
|
|
+ <script type="application/javascript" src="script/semantic/semantic.min.js"></script>
|
|
|
+ <script type="application/javascript" src="script/jquery.min.js"></script>
|
|
|
+ <script type="application/javascript" src="script/ao_module.js"></script>
|
|
|
+ <style>
|
|
|
+ body{
|
|
|
+ background-color:white;
|
|
|
+ }
|
|
|
+ .themebackground{
|
|
|
+ background-color:#588ce0 !important;
|
|
|
+ color:white !important;
|
|
|
+ background-image: url("/img/public/slate.png") !important;
|
|
|
+ background-repeat: no-repeat !important;
|
|
|
+ background-attachment: fixed !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ui.padded.slate{
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ padding: 4em;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ui.heading.slate{
|
|
|
+ align-items: flex-start;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ts.slate .header:not(.ts):not(.sub):not(.item){
|
|
|
+ line-height: 1.42857em;
|
|
|
+ font-weight: 500;
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+
|
|
|
+ .required{
|
|
|
+ color:red;
|
|
|
+ }
|
|
|
+ .actionbtns{
|
|
|
+ text-align:right;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <div class="ui heading fluid padded slate themebackground" >
|
|
|
+ <span class="header" style="font-size: 1.6em;"><i class="add icon"></i> New User</span>
|
|
|
+ <span class="description">Fill in the following user information to proceed.</span>
|
|
|
+ </div>
|
|
|
+ <br><br>
|
|
|
+ <div class="ui container">
|
|
|
+ <div class="ui horizontal form">
|
|
|
+ <div class="field">
|
|
|
+ <label>Username <span class="required">*</span></label>
|
|
|
+ <input id="username" type="text">
|
|
|
+ </div>
|
|
|
+ <!--
|
|
|
+ <div class="field">
|
|
|
+ <label>Description</label>
|
|
|
+ <input id="desc" type="text">
|
|
|
+ </div>
|
|
|
+ -->
|
|
|
+ <div class="field">
|
|
|
+ <label>Password <span class="required">*</span></label>
|
|
|
+ <input id="magic" type="password">
|
|
|
+ </div>
|
|
|
+ <div class="field">
|
|
|
+ <label>Confirm Password <span class="required">*</span></label>
|
|
|
+ <input id="repeatMagic" type="password">
|
|
|
+ </div>
|
|
|
+ <div class="field">
|
|
|
+ <label>User Group</label>
|
|
|
+ <select id="usergroups">
|
|
|
+ <option>Loading...</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <br>
|
|
|
+ <p><span class="required">*</span> This field is required.</p>
|
|
|
+ <div class="ui negative segment" id="err" style="display:none;">
|
|
|
+ <p><i class="remove icon"></i> <span id="errmsg"></span></p>
|
|
|
+ </div>
|
|
|
+ <div class="ui section divider"></div>
|
|
|
+ <div id="actionbtns" align="right">
|
|
|
+ <button class="ui primary button" onclick="createUser();">Create</button>
|
|
|
+ <button id="cancelbtn" class="ui button" onclick="cancel();">Cancel</button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ <script>
|
|
|
+ //Initiate the form items
|
|
|
+ //Get usergroups and list them in the usergroup list
|
|
|
+ $.get("system/permission/listgroup",function(data){
|
|
|
+ $("#usergroups").html("");
|
|
|
+ for(var i = 0; i < data.length; i++){
|
|
|
+ $("#usergroups").append(`<option value="${data[i]}">${data[i]}</option>`);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //Detect on enter keypress
|
|
|
+ $("input").on("keydown",function(event){
|
|
|
+ if (event.keyCode === 13) {
|
|
|
+ event.preventDefault();
|
|
|
+ createUser();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //Hide the cancel button if not in VDI
|
|
|
+ if ((!(!parent.isDesktopMode)) == false){
|
|
|
+ $("#cancelbtn").hide();
|
|
|
+ }
|
|
|
+
|
|
|
+ //Create the new user
|
|
|
+ function createUser(){
|
|
|
+ var username = $("#username").val();
|
|
|
+ var password = $("#magic").val();
|
|
|
+ var usergroup = $("#usergroups").val();
|
|
|
+ var valud = true;
|
|
|
+ //Clear previous error record
|
|
|
+ $("#magic").parent().removeClass("error");
|
|
|
+ $("#repeatMagic").parent().removeClass("error");
|
|
|
+ $("#username").parent().removeClass("error");
|
|
|
+
|
|
|
+ //Check if the username is correct
|
|
|
+ if (username == ""){
|
|
|
+ $("#username").parent().addClass("error");
|
|
|
+ valud = false;
|
|
|
+ }
|
|
|
+ //Check if the password match with the confirm
|
|
|
+ if (password != $("#repeatMagic").val()){
|
|
|
+ //Confirm password not match
|
|
|
+ $("#repeatMagic").parent().addClass("error");
|
|
|
+ valud = false;
|
|
|
+ }
|
|
|
+ if (password == ""){
|
|
|
+ //Password cannot be empty
|
|
|
+ $("#magic").parent().addClass("error");
|
|
|
+ $("#repeatMagic").parent().addClass("error");
|
|
|
+ valud = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!valud){
|
|
|
+ //Current input is invalid.
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //Create post reqest for user registering
|
|
|
+ $.post("system/auth/register",{username: username, password: password, group:usergroup}).done(function(data){
|
|
|
+ console.log(data);
|
|
|
+ if (data.includes("Error") == false){
|
|
|
+ //Everyhing is ok
|
|
|
+ //Check if user already logged in. If no, redirect to login interface
|
|
|
+ $.get("system/auth/checkLogin",function(data){
|
|
|
+ if (data == true){
|
|
|
+ if (!(!parent.isDesktopMode)){
|
|
|
+ //Perform a parent callback to check if there are any functions that requires update
|
|
|
+ ao_module_parentCallback(true);
|
|
|
+ parent.closeFwProcess($(window.frameElement).parent().parent().attr("windowId"));
|
|
|
+ }else{
|
|
|
+ //Tell the user to close this UI
|
|
|
+ window.location.href = "SystemAO/closeTabInsturction.html"
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ window.location.href = "/login.system";
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }else{
|
|
|
+ //There are errors.
|
|
|
+ $("#errmsg").text(data);
|
|
|
+ $("#err").slideDown('fast');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function cancel(){
|
|
|
+ if (!(!parent.isDesktopMode)){
|
|
|
+ parent.closeFwProcess($(window.frameElement).parent().parent().attr("windowId"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+ </body>
|
|
|
+</html>
|
|
|
+
|