diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2019-05-24 12:55:03 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-05-27 09:39:22 +0300 |
commit | 1365bf820df0e71fa5e4a53ef7bfc3af82a8eb0a (patch) | |
tree | 34a7c54c057e09e905f12e3a38a6bbfda1e0c4f3 /js | |
parent | ab468f0399faf0296965564fbb60c8967a2faeec (diff) |
Load a timezone file if no timezone is set
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'js')
-rw-r--r-- | js/timezone.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/js/timezone.js b/js/timezone.js new file mode 100644 index 00000000..e48e6227 --- /dev/null +++ b/js/timezone.js @@ -0,0 +1,39 @@ +/* global $, jstz, OC */ + +/* + * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * 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 <http://www.gnu.org/licenses/>. + */ + +console.debug('updating timezone and offset for SAML user') + +$.ajax({ + type: 'POST', + url: OC.generateUrl('/apps/user_saml/config/timezone'), + data: { + timezone: jstz.determine().name(), + timezoneOffset: (-new Date().getTimezoneOffset() / 60) + }, + error: function(e) { + console.error('could not set timezone and offset for SAML user', e) + }, + success: function() { + console.info('timezone and offset udpated for SAML user') + } +}) |