2018-04-15 13:02:32 +00:00
|
|
|
/**
|
|
|
|
* Settings interface
|
|
|
|
*
|
|
|
|
* @author Pierre HUBERT
|
|
|
|
*/
|
|
|
|
|
|
|
|
ComunicWeb.components.settings.interface = {
|
|
|
|
|
2018-04-16 14:15:48 +00:00
|
|
|
/**
|
|
|
|
* Get general account settings
|
|
|
|
*
|
|
|
|
* @param {function} callback
|
|
|
|
*/
|
|
|
|
getGeneral: function(callback){
|
|
|
|
|
|
|
|
//Make a request over the API
|
2018-04-16 14:16:55 +00:00
|
|
|
var apiURI = "settings/get_general";
|
2018-04-16 14:15:48 +00:00
|
|
|
var params = {};
|
|
|
|
ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback);
|
|
|
|
|
|
|
|
},
|
2018-04-15 13:02:32 +00:00
|
|
|
|
2018-04-17 17:47:18 +00:00
|
|
|
/**
|
|
|
|
* Set (update) general account settings
|
|
|
|
*
|
|
|
|
* @param {object} settings New general account settings
|
|
|
|
* @param {function} callback Callback function
|
|
|
|
*/
|
|
|
|
setGeneral: function(settings, callback){
|
|
|
|
var apiURI = "settings/set_general";
|
|
|
|
ComunicWeb.common.api.makeAPIrequest(apiURI, settings, true, callback);
|
|
|
|
},
|
|
|
|
|
2018-04-17 12:05:27 +00:00
|
|
|
/**
|
|
|
|
* Check the availability of the virtual directory for user
|
|
|
|
*
|
|
|
|
* @param {string} directory The directory to check
|
2018-04-19 08:20:49 +00:00
|
|
|
* @param {function} callback
|
2018-04-17 12:05:27 +00:00
|
|
|
*/
|
|
|
|
checkUserDirectoryAvailability: function(directory, callback){
|
|
|
|
var apiURI = "settings/check_user_directory_availability";
|
|
|
|
var params = {
|
|
|
|
directory: directory
|
|
|
|
};
|
|
|
|
ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback);
|
2018-04-18 16:33:18 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get security account settings
|
|
|
|
*
|
|
|
|
* @param {string} password The password of the user
|
|
|
|
* @param {function} callback Callback function
|
|
|
|
*/
|
|
|
|
getSecurity: function(password, callback){
|
|
|
|
var apiURI = "settings/get_security";
|
|
|
|
var params = {
|
|
|
|
password: password
|
|
|
|
};
|
|
|
|
ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback);
|
|
|
|
},
|
2018-04-17 12:05:27 +00:00
|
|
|
|
2018-04-19 08:20:49 +00:00
|
|
|
/**
|
|
|
|
* Set (update) security account settings
|
|
|
|
*
|
|
|
|
* @param {object} settings New settings
|
|
|
|
* @param {function} callback
|
|
|
|
*/
|
|
|
|
setSecurity: function(settings, callback){
|
|
|
|
var apiURI = "settings/set_security";
|
|
|
|
ComunicWeb.common.api.makeAPIrequest(apiURI, settings, true, callback);
|
2018-04-20 06:35:43 +00:00
|
|
|
},
|
2018-04-19 08:20:49 +00:00
|
|
|
|
2018-04-20 06:35:43 +00:00
|
|
|
/**
|
|
|
|
* Update the password of the user
|
|
|
|
*
|
|
|
|
* @param {string} oldPassword The old password of the user
|
|
|
|
* @param {string} newPassword The new password
|
|
|
|
* @param {function} callback
|
|
|
|
*/
|
|
|
|
updatePassword: function(oldPassword, newPassword, callback){
|
|
|
|
var apiURI = "settings/update_password";
|
|
|
|
var params = {
|
|
|
|
oldPassword: oldPassword,
|
|
|
|
newPassword: newPassword
|
|
|
|
};
|
|
|
|
ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback);
|
|
|
|
},
|
2018-04-15 13:02:32 +00:00
|
|
|
}
|