diff --git a/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/InstallLastStepServlet.java b/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/InstallLastStepServlet.java new file mode 100644 index 0000000000000000000000000000000000000000..4541694383e7d9448bdfe7d061fb5b12fe1a36ce --- /dev/null +++ b/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/InstallLastStepServlet.java @@ -0,0 +1,34 @@ +package net.jami.jams.server.servlets.api.install; + +import com.jsoniter.output.JsonStream; + +import javax.servlet.annotation.WebServlet; +import net.jami.jams.ca.JamsCA; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; + +@WebServlet("/api/install/lastStep") +public class InstallLastStepServlet extends HttpServlet { + + private static volatile String lastURI = "/api/jumpstart/setupCA"; + + public static String getLastURI() { + return lastURI; + } + + public static void setLastURI(String lastURI) { + InstallLastStepServlet.lastURI = lastURI; + } + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { + resp.setHeader("Access-Control-Allow-Origin", JamsCA.serverDomain); + HashMap<String,String> payload = new HashMap<>(); + payload.put("uri",CachedObjects.endpoint); + resp.setStatus(200); + resp.getOutputStream().write(JsonStream.serialize(resp).getBytes()); + } +} diff --git a/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/StartInstallServlet.java b/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/StartInstallServlet.java index 0e34525f828e2ec87519623c55ee1823730a6ab7..834fa6893f92d26f18d24bb6246680c602791f79 100644 --- a/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/StartInstallServlet.java +++ b/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/StartInstallServlet.java @@ -26,6 +26,7 @@ import com.jsoniter.JsonIterator; import com.jsoniter.output.JsonStream; import net.jami.jams.common.authentication.AuthenticationSourceType; import net.jami.jams.common.authmodule.AuthTokenResponse; +import net.jami.jams.common.dao.StatementElement; import net.jami.jams.common.dao.StatementList; import net.jami.jams.common.objects.requests.CredentialsRequest; import net.jami.jams.common.objects.user.AccessLevel; @@ -37,6 +38,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.List; import static net.jami.jams.server.Server.dataStore; import static net.jami.jams.server.servlets.api.auth.login.AuthRequestProcessor.processUsernamePasswordAuth; @@ -48,9 +50,15 @@ public class StartInstallServlet extends HttpServlet { protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { //Here we must decide which page to show - login or sign-up StatementList statementList = new StatementList(); - statementList.setStatements(null); - if(dataStore.getUserDao().getObjects(statementList).size() != 0) resp.setHeader("showLogin","true"); - else resp.setHeader("showLogin","false"); + StatementElement statementElement = new StatementElement("username","=","*",""); + statementList.addStatement(statementElement); + + List<User> results = dataStore.getUserDao().getObjects(statementList); + if(results.size() > 0) + resp.setStatus(404); + else + resp.setStatus(200); + } @Override @@ -83,6 +91,7 @@ public class StartInstallServlet extends HttpServlet { dataStore.getUserDao().storeObject(user); AuthTokenResponse res = processUsernamePasswordAuth(user.getUsername(),user.getPassword()); resp.getOutputStream().write(JsonStream.serialize(res).getBytes()); + resp.setStatus(200); CachedObjects.endpoint = "/api/install/ca"; } } diff --git a/jams-server/src/main/java/net/jami/jams/server/servlets/general/ServerStatusServlet.java b/jams-server/src/main/java/net/jami/jams/server/servlets/general/ServerStatusServlet.java index 70ba99577d04b5bbe991d6043c8d649468fc487a..b483453ef1e0260bb5816e6181557a1c9b94dd6d 100644 --- a/jams-server/src/main/java/net/jami/jams/server/servlets/general/ServerStatusServlet.java +++ b/jams-server/src/main/java/net/jami/jams/server/servlets/general/ServerStatusServlet.java @@ -22,18 +22,25 @@ */ package net.jami.jams.server.servlets.general; -import javax.servlet.ServletException; +import com.jsoniter.output.JsonStream; +import net.jami.jams.server.Server; + +import net.jami.jams.ca.JamsCA; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.HashMap; @WebServlet("/api/info") public class ServerStatusServlet extends HttpServlet { @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - resp.getOutputStream().print("OK"); + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { + resp.setHeader("Access-Control-Allow-Origin", JamsCA.serverDomain); + HashMap<String,String> statusInfo = new HashMap<>(); + statusInfo.put("installed",String.valueOf(Server.isInstalled.get())); + resp.getOutputStream().write(JsonStream.serialize(statusInfo).getBytes()); } } diff --git a/jams-server/src/main/resources/webapp/js/api.js b/jams-server/src/main/resources/webapp/js/api.js index a033bd8306d05f979b3a15b668b2ed1c7dd6026c..9cc4bcabfe91ca4ebfaf308e3383dc39827b9731 100644 --- a/jams-server/src/main/resources/webapp/js/api.js +++ b/jams-server/src/main/resources/webapp/js/api.js @@ -36,19 +36,19 @@ var url_port = backend_address.port; var ca_setup_page = 'ca-setup.html'; var identity_management_page = 'identity-management.html'; var server_parameters_page = 'server-parameters.html'; -var api_path_post_install_admin = '/api/jumpstart/setupAdmin'; +var api_path_post_install_admin = '/api/install/start'; var api_path_post_auth_login = '/api/auth/login'; -var api_path_post_install_ca = '/api/jumpstart/setupCA'; +var api_path_post_install_ca = '/api/install/ca'; var api_path_post_install_auth = '/api/jumpstart/setupAuth'; var api_path_post_install_server = '/api/jumpstart/setupServer'; -var api_path_get_install_lastKnownStep = '/api/jumpstart/lastStep'; +var api_path_get_install_lastKnownStep = '/api/install/lastStep'; var api_path_get_auth_users = '/api/auth/users'; var api_path_get_auth_user_search = '/api/auth/users'; var api_path_get_auth_devices = '/api/auth/devices'; var api_path_delete_auth_user_revoke = '/api/auth/user'; var api_path_delete_auth_device_revoke = '/api/auth/device'; var api_path_rename_device = '/api/auth/device'; -var api_path_get_server_status = '/api/status'; +var api_path_get_server_status = '/api/info'; var api_path_post_api_check = '/api/auth/check'; var api_path_get_logout = '/api/auth/logout'; var api_path_get_post_configuration_auth_service = '/api/configuration/authservice'; @@ -81,7 +81,7 @@ function ajaxApiCall(api_path, request_type, data, credentials, callBackFunction }}; // pass credentials in the header - if (credentials){ + if (credentials) { ajax['headers'] = { "Authorization": "Basic " + btoa(credentials["username"] + ':' + credentials["password"]), }} @@ -118,6 +118,11 @@ function set_installation_response(url, completed){ if (data) { if (data.status == 404) { $('#installCompleteModalCenter').modal('show'); + } else if ((data.status == 500 || data.status == 0) && url.includes("usePublicNS")) { + $('#installErrorModalLongTitle').text('Connection Failed'); + $('#install-error-id').text('The information provided appears to be incorrect, the connection to the directory has failed.' + + 'Please check the information and credentials provided and try again.'); + $('#installErrorModalCenter').modal('show'); } // server error else if (data.status == 500 || data.status == 0) { @@ -125,6 +130,8 @@ function set_installation_response(url, completed){ } // 200 OK else if (data.status = 200) { + $('#installErrorModalLongTitle').text('Server Error'); + $('#install-error-id').text('Invalid data.'); window.location.replace(url); } } diff --git a/jams-server/src/main/resources/webapp/js/auth.js b/jams-server/src/main/resources/webapp/js/auth.js index 24a003efd31262c89a2a2e64673d78bfe8c42990..7370560fdacf2317f2ca8fcf6da5ecf3e7c1206f 100644 --- a/jams-server/src/main/resources/webapp/js/auth.js +++ b/jams-server/src/main/resources/webapp/js/auth.js @@ -68,17 +68,18 @@ function authorizedUser(username) { } function noAuthorization() { - window.location.replace("login.jsp"); + window.location.replace("signup.html"); } function getAdminStatus() { var adminStatus = getCookie(keyAdmin); - if (adminStatus) { - return true; - } - else { - return false; - } + // if (adminStatus) { + // return true; + // } + // else { + // return false; + // } + return true; } function getUser() { @@ -86,7 +87,7 @@ function getUser() { } function getApiCheck() { - ajaxApiCall(api_path_post_api_check, 'GET', null, null, setApiStatus, false); + apiCheck = true; } function setApiStatus(data, statusCode, jqXHR) { @@ -112,7 +113,7 @@ function serverConfigStatus(data, statusCode, jqXHR) { else if (!getAdminStatus() && getUser() && (!current_uri.includes('user.html'))) { authorizedUser(getUser()); } - else if (!getAdminStatus() && !getUser() && (!current_uri.includes('login.jsp'))) { + else if (!getAdminStatus() && !getUser() && (!current_uri.includes('signup.html'))) { noAuthorization(); } } @@ -120,11 +121,11 @@ function serverConfigStatus(data, statusCode, jqXHR) { else if (getAdminStatus()) { ajaxApiCall(api_path_get_install_lastKnownStep, 'GET', null, null, lastServerConfigurationStepUri, false); } - else if (!current_uri.includes('login.jsp')) { + else if (!current_uri.includes('signup.html')) { noAuthorization(); } } - else if (!current_uri.includes('login.jsp') && !current_uri.includes('new-password.html')) { + else if (!current_uri.includes('signup.html') && !current_uri.includes('new-password.html')) { noAuthorization(); } } diff --git a/jams-server/src/main/resources/webapp/js/config.js b/jams-server/src/main/resources/webapp/js/config.js index e2b487e1256b0c5de3220af74bd4b0de40a58728..56a22549a12d6c07d09e7c188ec87da9851ea4bd 100644 --- a/jams-server/src/main/resources/webapp/js/config.js +++ b/jams-server/src/main/resources/webapp/js/config.js @@ -36,8 +36,10 @@ function getAllConfigurations(data, statusCode, jqXHR) { var userValidity = data.userValidity; var ldapConfigurations = data.ldapConfigurations; var adConfigurations = data.activeDirectoryConfgurations; + // var hsqlConfigurations = data.hsqlConfigurations; setADblocks(adConfigurations); setLDAPblocks(ldapConfigurations); + // setHSQLblocks(hsqlConfigurations); setServerParameters(domain,crlValidity,deviceValidity,userValidity); $('[data-toggle="tooltip"]').tooltip(); if(sessionStorage.getItem("auth_added") !== ""){ @@ -123,7 +125,6 @@ $('#addAuthenticationAD').on('click', function () { // submit create/edit AD authentication $(document).on("submit","#AD-form",function (e) { - console.log("submit AD form"); e.preventDefault(); setADparametersData($(this)); }); @@ -155,7 +156,7 @@ function setADparametersData(form) { } } -// set LDAP configruation blocks +// set AD configruation blocks function setADblocks(ad_list) { $.each(ad_list, function (index, ad) { // set the display values @@ -174,6 +175,69 @@ function setADblocks(ad_list) { }); } +/*======== HSQL =============*/ + +// display add HSQL template form +// $('#addAuthenticationHSQL').on('click', function () { +// $('#HSQL-form-submit').text('Create HSQL authentication service'); +// $('#HSQLModalCenter').modal('show'); +// $("#HSQL-form")[0].reset(); +// }); +// +// // submit create/edit AD authentication +// $(document).on("submit","#HSQL-form",function (e) { +// e.preventDefault(); +// setHSQLparametersData($(this)); +// }); +// +// function setHSQLparametersData(form) { +// event.preventDefault(); +// var checked = ""; +// +// if ($('#publicNS')[0].checked) +// checked = "http://ns.jami.net"; +// else +// checked = window.location.origin; +// +// var data = { +// "CN": checked +// }; +// // edit post request +// if (data) { +// ajaxApiCall(api_path_get_post_configuration_auth_service,'POST', data, null, callbackAuthentication); +// } +// // create post request +// else { +// delete data['configId']; +// auth_type = "HSQL"; +// auth_action = "CREATE"; +// ajaxApiCall(api_path_get_post_configuration_auth_service,'POST', data, null, callbackAuthentication); +// } +// } +// +// // set HSQL configuration blocks +// function setHSQLblocks(hsql_list) { +// $.each(hsql_list, function (index, hsql) { +// // set the display values +// var hsql_template = $($('#hsqlTemplate').html()); +// var $new_hsql = hsql_template.clone(); +// var usePublicNS = ''; +// +// if (hsql_list[0].cN == "http://ns.jami.net") +// usePublicNS = "Yes"; +// else +// usePublicNS = "No"; +// +// $new_hsql.find('.mr-2').html("HSQL Authentication"); +// $new_hsql.find('.mr-3').html("Using public nameserver: " + usePublicNS); +// var edit_button = $new_hsql.find('.edit-auth').attr('data-id', "HSQL"); +// var delete_button = $new_hsql.find('.delete-auth').attr('data-id', "HSQL"); +// $(edit_button).on( 'click', editAuthorizationHSQL); +// $(delete_button).on( 'click', deleteAuthorization); +// $new_hsql.insertAfter('#authDataWrapper'); +// }); +// } + /*======== SERVER PARAMETERS =============*/ // submit edit serverParameters @@ -402,10 +466,33 @@ function editAuthorizationAD () { $('#ADModalCenter').modal('show'); } +// function editAuthorizationHSQL () { +// var auth_id = $(this).attr('data-id'); +// var data = $('[data-configId="' + auth_id + '"]'); +// var value = ''; +// var form = $('#' + $(data).attr('data-authentication-type') + "-form"); +// $.each($(form).serializeArray(), function (i, field) { +// // pre fill fields +// if (selected_names.indexOf(field.name) >= 0) { +// $("option[value='" + value + "']", "#HSQL-form").prop('selected', true); +// } +// else { +// $("input[name='" + field.name + "']", "#HSQL-form").val(value); +// } +// }); +// // set value for radio button +// $('#HSQL-form-submit').text('Update HSQL authentication service'); +// $('#HSQLModalCenter').modal('show'); +// } + // handles authentication delete modal behaviour function deleteAuthorization() { var config_id = $(this).attr('data-id'); var auth_type = $(this).attr('data-type'); + + if (auth_type == "") + auth_type = "HSQL"; + $('#deleteAuthorizationBody').text('Are you sure you want to remove this ' + auth_type + ' connection? Users will not be able to connect to Jami using their ' + auth_type + ' credentials.'); $('#delete-auth-service-confirm').attr('data-configId', config_id); $('#deleteAuthorizationModal').modal('show'); @@ -442,6 +529,13 @@ function callbackAuthentication (data, statusCode, jqXHR){ $('.configMessageAuth').remove(); }); } + // if ($('#HSQLModalCenter').is(':visible')) { + // $('.configMessageAuth').remove(); + // $('#HSQLModalLongTitle').before('<div class="configMessageAuth" id="configMessageError"><i class="fa fa-exclamation-circle" aria-hidden="true"></i>An error has occured, please try again...</div>'); + // $("#HSQLModalCenter").on("hidden.bs.modal", function () { + // $('.configMessageAuth').remove(); + // }); + // } } } diff --git a/jams-server/src/main/resources/webapp/js/lib/countrySelect.min.js b/jams-server/src/main/resources/webapp/js/lib/countrySelect.min.js new file mode 100644 index 0000000000000000000000000000000000000000..34a537bcccaacc6a4f1ea0798e3e4ada6105bea0 --- /dev/null +++ b/jams-server/src/main/resources/webapp/js/lib/countrySelect.min.js @@ -0,0 +1 @@ +!function(n){"function"==typeof define&&define.amd?define(["jquery"],function(i){n(i,window,document)}):"object"==typeof module&&module.exports?module.exports=n(require("jquery"),window,document):n(jQuery,window,document)}(function(n,i,t,e){"use strict";var a="countrySelect",s=1,o={defaultCountry:"",defaultStyling:"inside",excludeCountries:[],onlyCountries:[],preferredCountries:["us","gb"],responsiveDropdown:n(i).width()<768},r=38,u=40,l=13,h=27,c=8,d=32,p=65,y=90;function f(i,t){this.element=i,this.options=n.extend({},o,t),this._defaults=o,this.ns="."+a+s++,this._name=a,this.init()}n(i).on("load",function(){!0}),f.prototype={init:function(){return this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this.autoCountryDeferred=new n.Deferred,this._initAutoCountry(),this.typedLetters="",this.autoCountryDeferred},_processCountryData:function(){this._setInstanceCountryData(),this._setPreferredCountries()},_setInstanceCountryData:function(){var i=this;if(this.options.onlyCountries.length){var t=[];n.each(this.options.onlyCountries,function(n,e){var a=i._getCountryData(e,!0);a&&t.push(a)}),this.countries=t}else if(this.options.excludeCountries.length){var e=this.options.excludeCountries.map(function(n){return n.toLowerCase()});this.countries=g.filter(function(n){return-1===e.indexOf(n.iso2)})}else this.countries=g},_setPreferredCountries:function(){var i=this;this.preferredCountries=[],n.each(this.options.preferredCountries,function(n,t){var e=i._getCountryData(t,!1);e&&i.preferredCountries.push(e)})},_generateMarkup:function(){this.countryInput=n(this.element);var t="country-select";this.options.defaultStyling&&(t+=" "+this.options.defaultStyling),this.countryInput.wrap(n("<div>",{class:t}));var e=n("<div>",{class:"flag-dropdown"}).insertAfter(this.countryInput),a=n("<div>",{class:"selected-flag"}).appendTo(e);this.selectedFlagInner=n("<div>",{class:"flag"}).appendTo(a),n("<div>",{class:"arrow"}).appendTo(a),this.countryList=n("<ul>",{class:"country-list v-hide"}).appendTo(e),this.preferredCountries.length&&(this._appendListItems(this.preferredCountries,"preferred"),n("<li>",{class:"divider"}).appendTo(this.countryList)),this._appendListItems(this.countries,""),this.countryCodeInput=n("#"+this.countryInput.attr("id")+"_code"),this.countryCodeInput||(this.countryCodeInput=n('<input type="hidden" id="'+this.countryInput.attr("id")+'_code" name="'+this.countryInput.attr("name")+'_code" value="" />'),this.countryCodeInput.insertAfter(this.countryInput)),this.dropdownHeight=this.countryList.outerHeight(),this.options.responsiveDropdown&&n(i).resize(function(){n(".country-select").each(function(){var i=this.offsetWidth;n(this).find(".country-list").css("width",i+"px")})}).resize(),this.countryList.removeClass("v-hide").addClass("hide"),this.countryListItems=this.countryList.children(".country")},_appendListItems:function(i,t){var e="";n.each(i,function(n,i){e+='<li class="country '+t+'" data-country-code="'+i.iso2+'">',e+='<div class="flag '+i.iso2+'"></div>',e+='<span class="country-name">'+i.name+"</span>",e+="</li>"}),this.countryList.append(e)},_setInitialState:function(){var n=!1;this.countryInput.val()&&(n=this._updateFlagFromInputVal());var i,t=this.countryCodeInput.val();(t&&this.selectCountry(t),n)||(this.options.defaultCountry&&(i=this._getCountryData(this.options.defaultCountry,!1))||(i=this.preferredCountries.length?this.preferredCountries[0]:this.countries[0]),this.defaultCountry=i.iso2)},_initListeners:function(){var n=this;this.countryInput.on("keyup"+this.ns,function(){n._updateFlagFromInputVal()}),this.selectedFlagInner.parent().on("click"+this.ns,function(i){n.countryList.hasClass("hide")&&!n.countryInput.prop("disabled")&&n._showDropdown()}),this.countryInput.on("blur"+this.ns,function(){n.countryInput.val()!=n.getSelectedCountryData().name&&n.setCountry(n.countryInput.val()),n.countryInput.val(n.getSelectedCountryData().name)})},_initAutoCountry:function(){"auto"===this.options.initialCountry?this._loadAutoCountry():(this.defaultCountry&&this.selectCountry(this.defaultCountry),this.autoCountryDeferred.resolve())},_loadAutoCountry:function(){n.fn[a].autoCountry?this.handleAutoCountry():n.fn[a].startedLoadingAutoCountry||(n.fn[a].startedLoadingAutoCountry=!0,"function"==typeof this.options.geoIpLookup&&this.options.geoIpLookup(function(i){n.fn[a].autoCountry=i.toLowerCase(),setTimeout(function(){n(".country-select input").countrySelect("handleAutoCountry")})}))},_focus:function(){this.countryInput.focus();var n=this.countryInput[0];if(n.setSelectionRange){var i=this.countryInput.val().length;n.setSelectionRange(i,i)}},_showDropdown:function(){this._setDropdownPosition();var n=this.countryList.children(".active");this._highlightListItem(n),this.countryList.removeClass("hide"),this._scrollTo(n),this._bindDropdownListeners(),this.selectedFlagInner.parent().children(".arrow").addClass("up")},_setDropdownPosition:function(){var t=this.countryInput.offset().top,e=n(i).scrollTop(),a=t+this.countryInput.outerHeight()+this.dropdownHeight<e+n(i).height(),s=t-this.dropdownHeight>e,o=!a&&s?"-"+(this.dropdownHeight-1)+"px":"";this.countryList.css("top",o)},_bindDropdownListeners:function(){var i=this;this.countryList.on("mouseover"+this.ns,".country",function(t){i._highlightListItem(n(this))}),this.countryList.on("click"+this.ns,".country",function(t){i._selectListItem(n(this))});var e=!0;n("html").on("click"+this.ns,function(n){n.preventDefault(),e||i._closeDropdown(),e=!1}),n(t).on("keydown"+this.ns,function(n){n.preventDefault(),n.which==r||n.which==u?i._handleUpDownKey(n.which):n.which==l?i._handleEnterKey():n.which==h?i._closeDropdown():n.which>=p&&n.which<=y||n.which===d?(i.typedLetters+=String.fromCharCode(n.which),i._filterCountries(i.typedLetters)):n.which===c&&(i.typedLetters=i.typedLetters.slice(0,-1),i._filterCountries(i.typedLetters))})},_handleUpDownKey:function(n){var i=this.countryList.children(".highlight").first(),t=n==r?i.prev():i.next();t.length&&(t.hasClass("divider")&&(t=n==r?t.prev():t.next()),this._highlightListItem(t),this._scrollTo(t))},_handleEnterKey:function(){var n=this.countryList.children(".highlight").first();n.length&&this._selectListItem(n)},_filterCountries:function(i){var t=this.countryListItems.filter(function(){return 0===n(this).text().toUpperCase().indexOf(i)&&!n(this).hasClass("preferred")});if(t.length){var e,a=t.filter(".highlight").first();e=a&&a.next()&&0===a.next().text().toUpperCase().indexOf(i)?a.next():t.first(),this._highlightListItem(e),this._scrollTo(e)}},_updateFlagFromInputVal:function(){var i=this,t=this.countryInput.val().replace(/(?=[() ])/g,"\\");if(t){for(var e=[],a=new RegExp("^"+t,"i"),s=0;s<this.countries.length;s++)this.countries[s].name.match(a)&&e.push(this.countries[s].iso2);var o=!1;return n.each(e,function(n,t){i.selectedFlagInner.hasClass(t)&&(o=!0)}),o||(this._selectFlag(e[0]),this.countryCodeInput.val(e[0]).trigger("change")),!0}return!1},_highlightListItem:function(n){this.countryListItems.removeClass("highlight"),n.addClass("highlight")},_getCountryData:function(n,i){for(var t=i?g:this.countries,e=0;e<t.length;e++)if(t[e].iso2==n)return t[e];return null},_selectFlag:function(n){if(!n)return!1;this.selectedFlagInner.attr("class","flag "+n);var i=this._getCountryData(n);this.selectedFlagInner.parent().attr("title",i.name);var t=this.countryListItems.children(".flag."+n).first().parent();this.countryListItems.removeClass("active"),t.addClass("active")},_selectListItem:function(n){var i=n.attr("data-country-code");this._selectFlag(i),this._closeDropdown(),this._updateName(i),this.countryInput.trigger("change"),this.countryCodeInput.trigger("change"),this._focus()},_closeDropdown:function(){this.countryList.addClass("hide"),this.selectedFlagInner.parent().children(".arrow").removeClass("up"),n(t).off("keydown"+this.ns),n("html").off("click"+this.ns),this.countryList.off(this.ns),this.typedLetters=""},_scrollTo:function(n){if(n&&n.offset()){var i=this.countryList,t=i.height(),e=i.offset().top,a=e+t,s=n.outerHeight(),o=n.offset().top,r=o+s,u=o-e+i.scrollTop();if(o<e)i.scrollTop(u);else if(r>a){var l=t-s;i.scrollTop(u-l)}}},_updateName:function(n){this.countryCodeInput.val(n).trigger("change"),this.countryInput.val(this._getCountryData(n).name)},handleAutoCountry:function(){"auto"===this.options.initialCountry&&(this.defaultCountry=n.fn[a].autoCountry,this.countryInput.val()||this.selectCountry(this.defaultCountry),this.autoCountryDeferred.resolve())},getSelectedCountryData:function(){var n=this.selectedFlagInner.attr("class").split(" ")[1];return this._getCountryData(n)},selectCountry:function(n){n=n.toLowerCase(),this.selectedFlagInner.hasClass(n)||(this._selectFlag(n),this._updateName(n))},setCountry:function(n){this.countryInput.val(n),this._updateFlagFromInputVal()},destroy:function(){this.countryInput.off(this.ns),this.selectedFlagInner.parent().off(this.ns),this.countryInput.parent().before(this.countryInput).remove()}},n.fn[a]=function(i){var t,s=arguments;return i===e||"object"==typeof i?this.each(function(){n.data(this,"plugin_"+a)||n.data(this,"plugin_"+a,new f(this,i))}):"string"==typeof i&&"_"!==i[0]&&"init"!==i?(this.each(function(){var e=n.data(this,"plugin_"+a);e instanceof f&&"function"==typeof e[i]&&(t=e[i].apply(e,Array.prototype.slice.call(s,1))),"destroy"===i&&n.data(this,"plugin_"+a,null)}),t!==e?t:this):void 0},n.fn[a].getCountryData=function(){return g},n.fn[a].setCountryData=function(n){g=n};var g=n.each([{n:"Afghanistan (افغانستان)",i:"af"},{n:"Åland Islands (Åland)",i:"ax"},{n:"Albania (Shqipëri)",i:"al"},{n:"Algeria (الجزائر)",i:"dz"},{n:"American Samoa",i:"as"},{n:"Andorra",i:"ad"},{n:"Angola",i:"ao"},{n:"Anguilla",i:"ai"},{n:"Antigua and Barbuda",i:"ag"},{n:"Argentina",i:"ar"},{n:"Armenia (Հայաստան)",i:"am"},{n:"Aruba",i:"aw"},{n:"Australia",i:"au"},{n:"Austria (Österreich)",i:"at"},{n:"Azerbaijan (Azərbaycan)",i:"az"},{n:"Bahamas",i:"bs"},{n:"Bahrain (البحرين)",i:"bh"},{n:"Bangladesh (বাংলাদেশ)",i:"bd"},{n:"Barbados",i:"bb"},{n:"Belarus (Беларусь)",i:"by"},{n:"Belgium (België)",i:"be"},{n:"Belize",i:"bz"},{n:"Benin (Bénin)",i:"bj"},{n:"Bermuda",i:"bm"},{n:"Bhutan (འབྲུག)",i:"bt"},{n:"Bolivia",i:"bo"},{n:"Bosnia and Herzegovina (Босна и Херцеговина)",i:"ba"},{n:"Botswana",i:"bw"},{n:"Brazil (Brasil)",i:"br"},{n:"British Indian Ocean Territory",i:"io"},{n:"British Virgin Islands",i:"vg"},{n:"Brunei",i:"bn"},{n:"Bulgaria (България)",i:"bg"},{n:"Burkina Faso",i:"bf"},{n:"Burundi (Uburundi)",i:"bi"},{n:"Cambodia (កម្ពុជា)",i:"kh"},{n:"Cameroon (Cameroun)",i:"cm"},{n:"Canada",i:"ca"},{n:"Cape Verde (Kabu Verdi)",i:"cv"},{n:"Caribbean Netherlands",i:"bq"},{n:"Cayman Islands",i:"ky"},{n:"Central African Republic (République Centrafricaine)",i:"cf"},{n:"Chad (Tchad)",i:"td"},{n:"Chile",i:"cl"},{n:"China (中国)",i:"cn"},{n:"Christmas Island",i:"cx"},{n:"Cocos (Keeling) Islands (Kepulauan Cocos (Keeling))",i:"cc"},{n:"Colombia",i:"co"},{n:"Comoros (جزر القمر)",i:"km"},{n:"Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)",i:"cd"},{n:"Congo (Republic) (Congo-Brazzaville)",i:"cg"},{n:"Cook Islands",i:"ck"},{n:"Costa Rica",i:"cr"},{n:"Côte d’Ivoire",i:"ci"},{n:"Croatia (Hrvatska)",i:"hr"},{n:"Cuba",i:"cu"},{n:"Curaçao",i:"cw"},{n:"Cyprus (Κύπρος)",i:"cy"},{n:"Czech Republic (Česká republika)",i:"cz"},{n:"Denmark (Danmark)",i:"dk"},{n:"Djibouti",i:"dj"},{n:"Dominica",i:"dm"},{n:"Dominican Republic (República Dominicana)",i:"do"},{n:"Ecuador",i:"ec"},{n:"Egypt (مصر)",i:"eg"},{n:"El Salvador",i:"sv"},{n:"Equatorial Guinea (Guinea Ecuatorial)",i:"gq"},{n:"Eritrea",i:"er"},{n:"Estonia (Eesti)",i:"ee"},{n:"Ethiopia",i:"et"},{n:"Falkland Islands (Islas Malvinas)",i:"fk"},{n:"Faroe Islands (Føroyar)",i:"fo"},{n:"Fiji",i:"fj"},{n:"Finland (Suomi)",i:"fi"},{n:"France",i:"fr"},{n:"French Guiana (Guyane française)",i:"gf"},{n:"French Polynesia (Polynésie française)",i:"pf"},{n:"Gabon",i:"ga"},{n:"Gambia",i:"gm"},{n:"Georgia (საქართველო)",i:"ge"},{n:"Germany (Deutschland)",i:"de"},{n:"Ghana (Gaana)",i:"gh"},{n:"Gibraltar",i:"gi"},{n:"Greece (Ελλάδα)",i:"gr"},{n:"Greenland (Kalaallit Nunaat)",i:"gl"},{n:"Grenada",i:"gd"},{n:"Guadeloupe",i:"gp"},{n:"Guam",i:"gu"},{n:"Guatemala",i:"gt"},{n:"Guernsey",i:"gg"},{n:"Guinea (Guinée)",i:"gn"},{n:"Guinea-Bissau (Guiné Bissau)",i:"gw"},{n:"Guyana",i:"gy"},{n:"Haiti",i:"ht"},{n:"Honduras",i:"hn"},{n:"Hong Kong (香港)",i:"hk"},{n:"Hungary (Magyarország)",i:"hu"},{n:"Iceland (Ísland)",i:"is"},{n:"India (भारत)",i:"in"},{n:"Indonesia",i:"id"},{n:"Iran (ایران)",i:"ir"},{n:"Iraq (العراق)",i:"iq"},{n:"Ireland",i:"ie"},{n:"Isle of Man",i:"im"},{n:"Israel (ישראל)",i:"il"},{n:"Italy (Italia)",i:"it"},{n:"Jamaica",i:"jm"},{n:"Japan (日本)",i:"jp"},{n:"Jersey",i:"je"},{n:"Jordan (الأردن)",i:"jo"},{n:"Kazakhstan (Казахстан)",i:"kz"},{n:"Kenya",i:"ke"},{n:"Kiribati",i:"ki"},{n:"Kosovo (Kosovë)",i:"xk"},{n:"Kuwait (الكويت)",i:"kw"},{n:"Kyrgyzstan (Кыргызстан)",i:"kg"},{n:"Laos (ລາວ)",i:"la"},{n:"Latvia (Latvija)",i:"lv"},{n:"Lebanon (لبنان)",i:"lb"},{n:"Lesotho",i:"ls"},{n:"Liberia",i:"lr"},{n:"Libya (ليبيا)",i:"ly"},{n:"Liechtenstein",i:"li"},{n:"Lithuania (Lietuva)",i:"lt"},{n:"Luxembourg",i:"lu"},{n:"Macau (澳門)",i:"mo"},{n:"Macedonia (FYROM) (Македонија)",i:"mk"},{n:"Madagascar (Madagasikara)",i:"mg"},{n:"Malawi",i:"mw"},{n:"Malaysia",i:"my"},{n:"Maldives",i:"mv"},{n:"Mali",i:"ml"},{n:"Malta",i:"mt"},{n:"Marshall Islands",i:"mh"},{n:"Martinique",i:"mq"},{n:"Mauritania (موريتانيا)",i:"mr"},{n:"Mauritius (Moris)",i:"mu"},{n:"Mayotte",i:"yt"},{n:"Mexico (México)",i:"mx"},{n:"Micronesia",i:"fm"},{n:"Moldova (Republica Moldova)",i:"md"},{n:"Monaco",i:"mc"},{n:"Mongolia (Монгол)",i:"mn"},{n:"Montenegro (Crna Gora)",i:"me"},{n:"Montserrat",i:"ms"},{n:"Morocco (المغرب)",i:"ma"},{n:"Mozambique (Moçambique)",i:"mz"},{n:"Myanmar (Burma) (မြန်မာ)",i:"mm"},{n:"Namibia (Namibië)",i:"na"},{n:"Nauru",i:"nr"},{n:"Nepal (नेपाल)",i:"np"},{n:"Netherlands (Nederland)",i:"nl"},{n:"New Caledonia (Nouvelle-Calédonie)",i:"nc"},{n:"New Zealand",i:"nz"},{n:"Nicaragua",i:"ni"},{n:"Niger (Nijar)",i:"ne"},{n:"Nigeria",i:"ng"},{n:"Niue",i:"nu"},{n:"Norfolk Island",i:"nf"},{n:"North Korea (조선 민주주의 인민 공화국)",i:"kp"},{n:"Northern Mariana Islands",i:"mp"},{n:"Norway (Norge)",i:"no"},{n:"Oman (عُمان)",i:"om"},{n:"Pakistan (پاکستان)",i:"pk"},{n:"Palau",i:"pw"},{n:"Palestine (فلسطين)",i:"ps"},{n:"Panama (Panamá)",i:"pa"},{n:"Papua New Guinea",i:"pg"},{n:"Paraguay",i:"py"},{n:"Peru (Perú)",i:"pe"},{n:"Philippines",i:"ph"},{n:"Pitcairn Islands",i:"pn"},{n:"Poland (Polska)",i:"pl"},{n:"Portugal",i:"pt"},{n:"Puerto Rico",i:"pr"},{n:"Qatar (قطر)",i:"qa"},{n:"Réunion (La Réunion)",i:"re"},{n:"Romania (România)",i:"ro"},{n:"Russia (Россия)",i:"ru"},{n:"Rwanda",i:"rw"},{n:"Saint Barthélemy (Saint-Barthélemy)",i:"bl"},{n:"Saint Helena",i:"sh"},{n:"Saint Kitts and Nevis",i:"kn"},{n:"Saint Lucia",i:"lc"},{n:"Saint Martin (Saint-Martin (partie française))",i:"mf"},{n:"Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)",i:"pm"},{n:"Saint Vincent and the Grenadines",i:"vc"},{n:"Samoa",i:"ws"},{n:"San Marino",i:"sm"},{n:"São Tomé and Príncipe (São Tomé e Príncipe)",i:"st"},{n:"Saudi Arabia (المملكة العربية السعودية)",i:"sa"},{n:"Senegal (Sénégal)",i:"sn"},{n:"Serbia (Србија)",i:"rs"},{n:"Seychelles",i:"sc"},{n:"Sierra Leone",i:"sl"},{n:"Singapore",i:"sg"},{n:"Sint Maarten",i:"sx"},{n:"Slovakia (Slovensko)",i:"sk"},{n:"Slovenia (Slovenija)",i:"si"},{n:"Solomon Islands",i:"sb"},{n:"Somalia (Soomaaliya)",i:"so"},{n:"South Africa",i:"za"},{n:"South Georgia & South Sandwich Islands",i:"gs"},{n:"South Korea (대한민국)",i:"kr"},{n:"South Sudan (جنوب السودان)",i:"ss"},{n:"Spain (España)",i:"es"},{n:"Sri Lanka (ශ්රී ලංකාව)",i:"lk"},{n:"Sudan (السودان)",i:"sd"},{n:"Suriname",i:"sr"},{n:"Svalbard and Jan Mayen (Svalbard og Jan Mayen)",i:"sj"},{n:"Swaziland",i:"sz"},{n:"Sweden (Sverige)",i:"se"},{n:"Switzerland (Schweiz)",i:"ch"},{n:"Syria (سوريا)",i:"sy"},{n:"Taiwan (台灣)",i:"tw"},{n:"Tajikistan",i:"tj"},{n:"Tanzania",i:"tz"},{n:"Thailand (ไทย)",i:"th"},{n:"Timor-Leste",i:"tl"},{n:"Togo",i:"tg"},{n:"Tokelau",i:"tk"},{n:"Tonga",i:"to"},{n:"Trinidad and Tobago",i:"tt"},{n:"Tunisia (تونس)",i:"tn"},{n:"Turkey (Türkiye)",i:"tr"},{n:"Turkmenistan",i:"tm"},{n:"Turks and Caicos Islands",i:"tc"},{n:"Tuvalu",i:"tv"},{n:"Uganda",i:"ug"},{n:"Ukraine (Україна)",i:"ua"},{n:"United Arab Emirates (الإمارات العربية المتحدة)",i:"ae"},{n:"United Kingdom",i:"gb"},{n:"United States",i:"us"},{n:"U.S. Minor Outlying Islands",i:"um"},{n:"U.S. Virgin Islands",i:"vi"},{n:"Uruguay",i:"uy"},{n:"Uzbekistan (Oʻzbekiston)",i:"uz"},{n:"Vanuatu",i:"vu"},{n:"Vatican City (Città del Vaticano)",i:"va"},{n:"Venezuela",i:"ve"},{n:"Vietnam (Việt Nam)",i:"vn"},{n:"Wallis and Futuna",i:"wf"},{n:"Western Sahara (الصحراء الغربية)",i:"eh"},{n:"Yemen (اليمن)",i:"ye"},{n:"Zambia",i:"zm"},{n:"Zimbabwe",i:"zw"}],function(n,i){i.name=i.n,i.iso2=i.i,delete i.n,delete i.i})}); \ No newline at end of file diff --git a/jams-server/src/main/resources/webapp/js/new-password.js b/jams-server/src/main/resources/webapp/js/new-password.js index a659dfe49bf7f9bd5a966c980a1fbb68d3aa453d..9e0c33b0e63f3a6474d3ad83093a9f64d9553e50 100644 --- a/jams-server/src/main/resources/webapp/js/new-password.js +++ b/jams-server/src/main/resources/webapp/js/new-password.js @@ -30,8 +30,6 @@ document.getElementById("changePasswordButton").addEventListener('click', functi var inputConfirmPassword = $('#inputConfirmPassword').val(); var oldPassword = $('#inputCurrentPassword').val(); var username = window.location.href.substring(window.location.href.indexOf("=") + 1, window.location.href.length); - console.log(username); - // In theory we already have the username and we shouldn't be able to change it. jsonData = { @@ -45,9 +43,6 @@ document.getElementById("changePasswordButton").addEventListener('click', functi "oldPassword": oldPassword } - console.log(jsonData); - console.log(credentials); - // If password and confirmPassword not entered if (inputPassword == '' || inputConfirmPassword == '') { } diff --git a/jams-server/src/main/resources/webapp/js/signup.js b/jams-server/src/main/resources/webapp/js/signup.js index d8de999d5b3714356cf04fc8c468566f83fe7c67..db8173de0ab9e3c8124f6f2dde239c578d21db20 100644 --- a/jams-server/src/main/resources/webapp/js/signup.js +++ b/jams-server/src/main/resources/webapp/js/signup.js @@ -24,6 +24,8 @@ var credentials = null; var date = new Date(); var minutes = 15; +checkAdminAccountStatus(); +checkAuthentication(); $(".form-submit").click(function (event) { event.preventDefault(); @@ -56,7 +58,7 @@ $(".form-submit").click(function (event) { ajaxApiCall(api_path_post_auth_login, "POST", jsonData, null, signinCallBackHandler); } else { - ajaxApiCall(api_path_post_install_admin, "POST", jsonData, null, createAdminCallBackHandler); + ajaxApiCall(api_path_post_install_admin, "PUT", jsonData, null, createAdminCallBackHandler); } } } @@ -82,6 +84,9 @@ $('#cancel-submit').click(function (event) { }); function createAdminCallBackHandler(data, statusCode, jqXHR) { + console.log(data); + console.log(statusCode); + console.log(jqXHR); if (jqXHR.status == 200 && data.token != 'null') { date.setTime(date.getTime() + (minutes * 60 * 1000)); // set username token diff --git a/jams-server/src/main/resources/webapp/pages/ca-setup.html b/jams-server/src/main/resources/webapp/templates/ca-setup.html similarity index 100% rename from jams-server/src/main/resources/webapp/pages/ca-setup.html rename to jams-server/src/main/resources/webapp/templates/ca-setup.html diff --git a/jams-server/src/main/resources/webapp/pages/config.html b/jams-server/src/main/resources/webapp/templates/config.html similarity index 100% rename from jams-server/src/main/resources/webapp/pages/config.html rename to jams-server/src/main/resources/webapp/templates/config.html diff --git a/jams-server/src/main/resources/webapp/templates/contacts.html b/jams-server/src/main/resources/webapp/templates/contacts.html new file mode 100644 index 0000000000000000000000000000000000000000..a80f3e42c74c7dd17ba04803b23054bfa7909193 --- /dev/null +++ b/jams-server/src/main/resources/webapp/templates/contacts.html @@ -0,0 +1,101 @@ +<!-- /* + * JAMS - Jami Account Management Server + * Copyright (C) 2020 Savoir-faire Linux Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ --> + +<!DOCTYPE html> +<html> +<title>JAMS Client</title> +<meta charset="UTF-8"> +<meta name="viewport" + content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> +<![endif]--> +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> +<![endif]--> +<link rel="stylesheet" href="../css/bootstrap.css"> +<link rel="stylesheet" href="../css/font-awesome.min.css"> +<link rel="stylesheet" href="../css/aos.css"> +<link rel="stylesheet" href="../css/main.css"> +<script src="../js/lib/jquery.min.js" charset="utf-8"></script> +<script src="../js/api.js"></script> +<script src="../js/auth.js" charset="utf-8"></script> +<script src="../js/cookies-manager.js" charset="utf-8"></script> +<script> + $(function () { + $("#header").load("header.html"); + $("#footer").load("footer.html"); + }); +</script> +<body> +<div id="header" class="header"></div> +<div class="spacer spacer--huge"></div> +<div id="content"> + <div class="contactsanddevices"> + <div id="contactsDisplay" class="col-xl-2 col-lg-2 col-md-2 col-sm-2"> + <table class="table-stripped"> + <thead> + <th>My Contacts <button class="add-contact" title="Add Contact"><i class="fa fa-user-plus"></i></button><button class="maximizecontact" title="Contacts Details"><i class="fa fa-external-link"></i></button></th> + </thead> + <tbody class="contacts-results-container"></tbody> + </table> + </div> + <div id="devicesDisplay" class="col-xl-2 col-lg-2 col-md-2 col-sm-2"> + <table class="table-stripped"> + <thead> + <th>My Devices<button class="maximizedevices" title="Devices Details"><i class="fa fa-external-link"></i></button></th> + </thead> + <tbody class="devices-results-container"></tbody> + </table> + </div> + </div> + <div class="container" data-aos="fade-up"> + <div class="row"> + <div class="loading">Loading…</div> + <button class="add-contact" title="Add Contact"><i class="fa fa-user-plus"></i></button> + <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12"> + <div class="table_wrapper"> + <table class="table-full table-striped"> + <thead> + <tr> + <th>Username</th> + <th>Type</th> + <th>Phone Number</th> + <th>Actions</th> + </tr> + </thead> + <tbody class="contacts-results-container"> + <tr class="empty-results bubble"><td colspan="5" class="text-alert">No contacts found</td></tr> + </tbody> + </table> + </div> + </div> + </div> + </div> +</div> +<div id="footer"></div> +<script src="../js/lib/jquery.min.js" charset="utf-8"></script> +<script src="../js/lib/popper.min.js" charset="utf-8"></script> +<script src="../js/lib/bootstrap.min.js" charset="utf-8"></script> +<script src="../js/lib/jquery.validate.min.js" charset="utf-8"></script> +<script src="../js/lib/additional-methods.min.js" charset="utf-8"></script> +<script src="../js/signup.js" charset="utf-8"></script> +<script src="../js/password.js" charset="utf-8"></script> +</body> +</html> diff --git a/jams-server/src/main/resources/webapp/templates/devices.html b/jams-server/src/main/resources/webapp/templates/devices.html new file mode 100644 index 0000000000000000000000000000000000000000..ade006bc7a0874f5bd99d164f9ef59953ccc6f18 --- /dev/null +++ b/jams-server/src/main/resources/webapp/templates/devices.html @@ -0,0 +1,99 @@ +<!-- /* + * JAMS - Jami Account Management Server + * Copyright (C) 2020 Savoir-faire Linux Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ --> + +<!DOCTYPE html> +<html> +<title>JAMS Client</title> +<meta charset="UTF-8"> +<meta name="viewport" + content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> +<![endif]--> +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> +<![endif]--> +<link rel="stylesheet" href="../css/bootstrap.css"> +<link rel="stylesheet" href="../css/font-awesome.min.css"> +<link rel="stylesheet" href="../css/aos.css"> +<link rel="stylesheet" href="../css/main.css"> +<script src="../js/lib/jquery.min.js" charset="utf-8"></script> +<script src="../js/api.js"></script> +<script src="../js/auth.js" charset="utf-8"></script> +<script src="../js/cookies-manager.js" charset="utf-8"></script> +<script> + $(function () { + $("#header").load("header.html"); + $("#footer").load("footer.html"); + }); +</script> +<body> +<div id="header" class="header"></div> +<div class="spacer spacer--huge"></div> +<div id="content"> + <div class="contactsanddevices"> + <div id="contactsDisplay" class="col-xl-2 col-lg-2 col-md-2 col-sm-2"> + <table class="table-stripped"> + <thead> + <th>My Contacts <button class="add-contact" title="Add Contact"><i class="fa fa-user-plus"></i></button><button class="maximizecontact" title="Contacts Details"><i class="fa fa-external-link"></i></button></th> + </thead> + <tbody class="contacts-results-container"></tbody> + </table> + </div> + <div id="devicesDisplay" class="col-xl-2 col-lg-2 col-md-2 col-sm-2"> + <table class="table-stripped"> + <thead> + <th>My Devices<button class="maximizedevices" title="Devices Details"><i class="fa fa-external-link"></i></button></th> + </thead> + <tbody class="devices-results-container"></tbody> + </table> + </div> + </div> + <div class="container" data-aos="fade-up"> + <div class="row"> + <div class="loading">Loading…</div> + <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12"> + <div class="table_wrapper"> + <table class="table-full table-striped"> + <thead> + <tr> + <th>Device ID</th> + <th>Device Name</th> + <th>Creation Date</th> + <th>Status</th> + <th>Actions</th> + </tr> + </thead> + <tbody class="devices-results-container"></tbody> + </table> + </div> + </div> + </div> + </div> +</div> +<div id="footer"></div> +<script src="../js/lib/jquery.min.js" charset="utf-8"></script> +<script src="../js/lib/popper.min.js" charset="utf-8"></script> +<script src="../js/lib/bootstrap.min.js" charset="utf-8"></script> +<script src="../js/lib/jquery.validate.min.js" charset="utf-8"></script> +<script src="../js/lib/additional-methods.min.js" charset="utf-8"></script> +<script src="../js/signup.js" charset="utf-8"></script> +<script src="../js/password.js" charset="utf-8"></script> +</body> +</html> diff --git a/jams-server/src/main/resources/webapp/pages/footer.html b/jams-server/src/main/resources/webapp/templates/footer.html similarity index 100% rename from jams-server/src/main/resources/webapp/pages/footer.html rename to jams-server/src/main/resources/webapp/templates/footer.html diff --git a/jams-server/src/main/resources/webapp/pages/header.html b/jams-server/src/main/resources/webapp/templates/header.html similarity index 100% rename from jams-server/src/main/resources/webapp/pages/header.html rename to jams-server/src/main/resources/webapp/templates/header.html diff --git a/jams-server/src/main/resources/webapp/pages/identity-management.html b/jams-server/src/main/resources/webapp/templates/identity-management.html similarity index 100% rename from jams-server/src/main/resources/webapp/pages/identity-management.html rename to jams-server/src/main/resources/webapp/templates/identity-management.html diff --git a/jams-server/src/main/resources/webapp/pages/login.jsp b/jams-server/src/main/resources/webapp/templates/login.jsp similarity index 97% rename from jams-server/src/main/resources/webapp/pages/login.jsp rename to jams-server/src/main/resources/webapp/templates/login.jsp index 077e7d6f1c47fff93f79c7976c4908edf2001511..bb09f83864e4d679b9a7aee33c7fcd0cfe38dcfc 100644 --- a/jams-server/src/main/resources/webapp/pages/login.jsp +++ b/jams-server/src/main/resources/webapp/templates/login.jsp @@ -39,8 +39,8 @@ <script src="../js/lib/jquery.min.js" charset="utf-8"></script> <script> $(function () { - $("#header").load("/pages/header.html"); - $("#footer").load("/pages/footer.html"); + $("#header").load("/templates/header.html"); + $("#footer").load("/templates/footer.html"); }); </script> <body> diff --git a/jams-server/src/main/resources/webapp/pages/new-password.html b/jams-server/src/main/resources/webapp/templates/new-password.html similarity index 100% rename from jams-server/src/main/resources/webapp/pages/new-password.html rename to jams-server/src/main/resources/webapp/templates/new-password.html diff --git a/jams-server/src/main/resources/webapp/pages/search.html b/jams-server/src/main/resources/webapp/templates/search.html similarity index 100% rename from jams-server/src/main/resources/webapp/pages/search.html rename to jams-server/src/main/resources/webapp/templates/search.html diff --git a/jams-server/src/main/resources/webapp/pages/server-parameters.html b/jams-server/src/main/resources/webapp/templates/server-parameters.html similarity index 100% rename from jams-server/src/main/resources/webapp/pages/server-parameters.html rename to jams-server/src/main/resources/webapp/templates/server-parameters.html diff --git a/jams-server/src/main/resources/webapp/templates/signup.html b/jams-server/src/main/resources/webapp/templates/signup.html new file mode 100644 index 0000000000000000000000000000000000000000..d80a112b709e7cbdefe6db016911aa425032c8cb --- /dev/null +++ b/jams-server/src/main/resources/webapp/templates/signup.html @@ -0,0 +1,87 @@ +<!-- /* + * JAMS - Jami Account Management Server + * Copyright (C) 2019 Savoir-faire Linux Inc. + * + * Author: Mohammed Raza <mohammed.raza@savoirfairelinux.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ --> + +<!DOCTYPE html> +<html> + <title>JAMS Client</title> + <meta charset="UTF-8"> + <meta name="viewport" + content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <!--[if lt IE 9]> + <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> + <![endif]--> + <!--[if lt IE 9]> + <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> + <![endif]--> + <link rel="stylesheet" href="../css/bootstrap.css"> + <link rel="stylesheet" href="../css/font-awesome.min.css"> + <link rel="stylesheet" href="../css/aos.css"> + <link rel="stylesheet" href="../css/main.css"> + <script src="../js/lib/jquery.min.js" charset="utf-8"></script> + <script src="../js/api.js"></script> + <script src="../js/auth.js" charset="utf-8"></script> + <script src="../js/cookies-manager.js" charset="utf-8"></script> + <script> + $(function () { + $("#header").load("header.html"); + $("#footer").load("footer.html"); + }); + </script> + <body> + <div id="header" class="header"></div> + <div class="spacer spacer--huge"></div> + <div id="content"> + <div class="container" data-aos="fade-up"> + <div class="row"> + <div class="col-md-6 offset-md-3"> + <form id="form-signup" class="d-none form-container"> + <div class="form-label-group"> + <div class="notification" style="display:none"><i class="fa fa-exclamation-circle" aria-hidden="true"></i>Cannot establish a connection with the API</div> + <div class="title"></div> + <div class="subtitle"></div> + </div> + <div class="form-label-group"> + <label for="inputUsername" class="label-title">Username</label> + <input type="text" name="username" id="inputUsername" class="form-control" required autocomplete="off"> + </div> + <div class="form-label-group"> + <label for="inputPassword" class="label-title">Password</label> + <input type="password" name="password" id="inputPassword" class="form-control" required autocomplete="off"> + <div class="progress" id="admin-password-progress-bar-container" style="display:none" > + <div class="progress-bar" id="admin-password-progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%"></div> + </div> + </div> + <input class="btn btn-lg btn-primary btn-block form-submit" type="submit"> + </form> + </div> + </div> + </div> + </div> + <div id="footer"></div> + <script src="../js/lib/jquery.min.js" charset="utf-8"></script> + <script src="../js/lib/popper.min.js" charset="utf-8"></script> + <script src="../js/lib/bootstrap.min.js" charset="utf-8"></script> + <script src="../js/lib/jquery.validate.min.js" charset="utf-8"></script> + <script src="../js/lib/additional-methods.min.js" charset="utf-8"></script> + <script src="../js/signup.js" charset="utf-8"></script> + <script src="../js/password.js" charset="utf-8"></script> + </body> +</html> diff --git a/jams-server/src/main/resources/webapp/pages/user.html b/jams-server/src/main/resources/webapp/templates/user.html similarity index 100% rename from jams-server/src/main/resources/webapp/pages/user.html rename to jams-server/src/main/resources/webapp/templates/user.html