diff options
Diffstat (limited to 'web/app/view/login/LoginController.js')
-rw-r--r-- | web/app/view/login/LoginController.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/web/app/view/login/LoginController.js b/web/app/view/login/LoginController.js index e94d0de9d..6620e07df 100644 --- a/web/app/view/login/LoginController.js +++ b/web/app/view/login/LoginController.js @@ -28,6 +28,26 @@ Ext.define('Traccar.view.login.LoginController', { ); }, + onSelectLanguage: function(selected) { + var paramName = 'locale'; + var paramValue = selected.getValue(); + var url = window.location.href; + if (url.indexOf(paramName + '=') >= 0) { + var prefix = url.substring(0, url.indexOf(paramName)); + var suffix = url.substring(url.indexOf(paramName)); + suffix = suffix.substring(suffix.indexOf("=") + 1); + suffix = (suffix.indexOf('&') >= 0) ? suffix.substring(suffix.indexOf('&')) : ''; + url = prefix + paramName + "=" + paramValue + suffix; + } else { + if (url.indexOf('?') < 0) { + url += '?' + paramName + '=' + paramValue; + } else { + url += '&' + paramName + '=' + paramValue; + } + } + window.location.href = url; + }, + onAfterRender: function(field) { field.focus(); }, |