Commit Graph

109 Commits

Author SHA1 Message Date
Badlop 6e0161470e Update newest copyright year to 2021 (#3464) 2021-01-27 17:02:06 +01:00
Paweł Chmielowski 81e872c110 Don't do double utf-8 conversion on translated strings in str:format
This caused garbled text in some places in webadmin when using language
that used characters > 128.

Thanks to chengshq for noticing this and providing preliminary patch.
2020-11-09 12:20:35 +01:00
Stu Tomlinson bd11a00f8f
Use include_lib() to include headers from dependencies (#3369) 2020-09-03 13:45:57 +02:00
Badlop 864188ad65 Mark dangerous buttons with CSS (#3363) 2020-08-24 16:44:07 +02:00
Badlop 842ec1494c Fix to allow vhost admins to view WebAdmin menus (#3355) 2020-08-10 21:17:59 +02:00
Badlop e94b89a57d Display installed ejabberd version in webadmin footer (#3272) 2020-05-15 11:20:53 +02:00
Badlop d7d8085d3b Fix most EDoc errors, even if that's not used nowadays apparently 2020-05-11 19:53:13 +02:00
Badlop b7c088d4b0 Update links to the ejabberd Docs page in WebAdmin 2020-04-14 13:59:11 +02:00
Paweł Chmielowski 5ec214386e Make webadmin redirect to page that end with / 2020-03-26 14:17:48 +01:00
Paweł Chmielowski 73ba38ae35 Revert "Pass base path instead of level to support URL missing slash (#3177)"
This reverts commit e9d1201ea8.
2020-03-26 13:43:24 +01:00
Badlop e9d1201ea8 Pass base path instead of level to support URL missing slash (#3177) 2020-03-11 16:26:33 +01:00
Badlop 2d32c66fd7 Update copyright to 2020 (#3149) 2020-01-28 15:49:23 +01:00
Paweł Chmielowski 8d571adca8 Verify http host in web admin only if authentication is missing host
This should allow access to web admin through ip address or just served
from domain not defined in ejabberd hosts
2019-10-09 10:31:02 +02:00
Badlop 949e71efb6 Update Guide links in WebAdmin to website, as local file isn't included 2019-10-02 12:42:59 +02:00
Badlop 20205c66c1 Support custom base path in WebAdmin by using relative URLs (#3043) 2019-10-02 12:42:54 +02:00
Evgeny Khramtsov 5770946f03 Correctly handle unicode in log messages 2019-09-23 15:17:20 +03:00
Badlop e50ecf9e96 Fix some links to Guide in WebAdmin and add new ones (#3003) 2019-08-27 15:41:37 +02:00
Badlop 1fd75265d6 Use select fields to input host in WebAdmin Backup (#3000) 2019-08-22 18:35:43 +02:00
Badlop 94d50a447d Fix call to deprecated ejabberd_config:get_myhosts() (#3000) 2019-08-22 18:35:41 +02:00
Badlop a51aa2bc44 Check account auth provided in WebAdmin is a local host (#3000) 2019-08-22 17:13:13 +02:00
Evgeny Khramtsov 9ec69b8d62 Don't treat 'Host' header as a virtual XMPP host
Fixes #2989
2019-08-13 18:30:28 +03:00
Evgeny Khramtsov 15b4b3fa1b Fix typos using codespell 2019-07-16 22:07:39 +03:00
Evgeny Khramtsov a3e0cbbdd8 Make logging messages more consistent 2019-06-24 20:32:34 +03:00
Evgeny Khramtsov 370226417a Check if mod_last is loaded before calling its functions 2019-06-24 18:47:51 +03:00
Evgeny Khramtsov 00f2a736eb Improve extraction of translated strings
Now every such string MUST be encapsulated into ?T() macro.
The macro itself is defined in include/translate.hrl.
Example:

-module(foo).
-export([bar/1]).
-include("translate.hrl").

bar(Lang) ->
    translate:translate(Lang, ?T("baz")).
2019-06-22 17:08:45 +03:00
Evgeny Khramtsov a02cff0e78 Use new configuration validator 2019-06-14 12:33:26 +03:00
Paweł Chmielowski 538f35d05a Replace code using p1_time_compat wrapper with native functions
Since we now require R19, we shouldn't need that anymore.

There are still couple places where p1_time_compat:unique_timestamp() is
used as there is no direct equivalent.
2019-02-27 09:56:31 +01:00
Badlop c41c5b2185 Fix support to restart module with live options in WebAdmin 2019-02-06 13:30:30 +01:00
Paweł Chmielowski 56baa07d48 Reject request http_api request that have malformed Authentication header 2019-01-30 16:34:29 +01:00
Christophe Romain 3fa68b17d9 Remove slash producing url /admin//additions.js 2019-01-09 11:55:42 +01:00
Badlop 55417dfb37 Update copyright to 2019 (#2756) 2019-01-08 22:53:27 +01:00
Evgeny Khramtsov 08f3d066b1 Switch more log message to warning level
The commit is supposed to improve logging at loglevel 3, which
is the recommended level for high loaded ejabberd servers
2018-09-19 23:12:14 +03:00
Evgeny Khramtsov 2d246f61dd Fix some dialyzer warnings 2018-09-09 09:59:08 +03:00
Paweł Chmielowski 48be8e7b1e Adopt code that uses parse_listener_portip after result change 2018-07-11 14:07:24 +02:00
Evgeniy Khramtsov fd8e07af47 Get rid of ejabberd.hrl header
The header consisted of too many unrelated stuff and macros misuse.
Some stuff is moved into scram.hrl and type_compat.hrl.
All macros have been replaced with the corresponding function calls.

TODO: probably type_compat.hrl is not even needed anymore since
we support only Erlang >= OTP 17.5
2018-06-14 14:00:47 +03:00
Holger Weiss a2e1f5c882 Move ejabberd_http:url_encode/1 to 'misc' module 2018-04-03 00:12:43 +02:00
Evgeniy Khramtsov e1e7986918 Hardcode ACL rules used by ejabberd_web_admin 2018-03-19 12:29:07 +03:00
Evgeniy Khramtsov ba2b650464 Introduce new gen_mod callback: mod_options/1
The callback is supposed to provide known options and their default
values, as long as the documentation. Passing default values into
get_mod functions is now deprecated: all defaults should be provided
by the Mod:mod_options/1 callback.
2018-01-23 10:54:52 +03:00
Evgeniy Khramtsov cdc7c1d1ed Update copyright dates 2018-01-05 23:18:58 +03:00
Evgeniy Khramtsov 5a184b0433 Don't include CSS, javascript and image data directly in the code 2017-10-09 23:35:42 +03:00
Evgeniy Khramtsov e93762a720 Deprecate misc:encode_base64/1 and misc:decode_base64/1 2017-05-23 10:43:26 +03:00
Evgeniy Khramtsov cdb191bb48 Rename is_user_exists -> user_exists 2017-05-11 15:49:06 +03:00
Evgeniy Khramtsov 633b68db11 Use cache for authentication backends
The commit introduces the following API incompatibilities:

In ejabberd_auth.erl:
* dirty_get_registered_users/0 is renamed to get_users/0
* get_vh_registered_users/1 is renamed to get_users/1
* get_vh_registered_users/2 is renamed to get_users/2
* get_vh_registered_users_number/1 is renamed to count_users/1
* get_vh_registered_users_number/2 is renamed to count_users/2

In ejabberd_auth callbacks
* plain_password_required/0 is replaced by plain_password_required/1
  where the argument is a virtual host
* store_type/0 is replaced by store_type/1 where the argument is
  a virtual host
* set_password/3 is now an optional callback
* remove_user/3 callback is no longer needed
* remove_user/2 now should return `ok | {error, atom()}`
* is_user_exists/2 now must only be implemented for backends
  with `external` store type
* check_password/6 is no longer needed
* check_password/4 now must only be implemented for backends
  with `external` store type
* try_register/3 is now an optional callback and should return
  `ok | {error, atom()}`
* dirty_get_registered_users/0 is no longer needed
* get_vh_registered_users/1 is no longer needed
* get_vh_registered_users/2 is renamed to get_users/2
* get_vh_registered_users_number/1 is no longer needed
* get_vh_registered_users_number/2 is renamed to count_users/2
* get_password_s/2 is no longer needed
* get_password/2 now must only be implemented for backends with
  `plain` or `scram` store type

Additionally, the commit introduces two new callbacks:
* use_cache/1 where the argument is a virtual host
* cache_nodes/1 where the argument is a virtual host

New options are also introduced: `auth_use_cache`, `auth_cache_missed`,
`auth_cache_life_time` and `auth_cache_size`.
2017-05-11 14:37:21 +03:00
Evgeniy Khramtsov 01a2c9fe12 Add type specs for Module:opt_type/1 2017-05-08 12:59:28 +03:00
Paweł Chmielowski c64e77a08c Catch exceptions from acl:add_list in web admin 2017-05-04 12:01:22 +02:00
Evgeniy Khramtsov fddd6110e0 Don't validate an option in gen_mod:get*opt() functions
The changes are very similar to those from previous commit:
* Now there is no need to pass validating function in
  gen_mod:get_opt() and gen_mod:get_module_opt() functions,
  because the modules' configuration keeps already validated values.
* New functions gen_mod:get_opt/2 and gen_mod:get_module_opt/3 are
  introduced.
* Functions gen_mod:get_opt/4 and get_module_opt/5 are deprecated.
  If the functions are still called, the "function" argument is
  simply ignored.
* Validating callback Mod:listen_opt_type/1 is introduced to validate
  listening options at startup.
2017-04-30 19:01:47 +03:00
Evgeniy Khramtsov b82b93f8f0 Don't validate an option in ejabberd_config:get_option() functions
The commit introduces the following changes:
* Now there is no need to pass validating function in
  ejabberd_config:get_option() functions, because the configuration
  keeps already validated values.
* New function ejabberd_config:get_option/1 is introduced
* Function ejabberd_config:get_option/3 is deprecated. If the function
  is still called, the second argument (validating function) is simply
  ignored.
* The second argument for ejabberd_config:get_option/2 is now
  a default value, not a validating function.
2017-04-29 11:39:40 +03:00
Evgeniy Khramtsov 7129aebe76 Don't re-define validation functions in multiple places 2017-04-28 13:23:32 +03:00
Christophe Romain b1acd1183f Rename aux.erl as misc.erl
Thanks Microsoft Windows to not support some filenames
2017-04-11 12:13:58 +02:00
Evgeniy Khramtsov 7bcbea2108 Deprecate jlib.erl in favor of aux.erl
Since the main goal of jlib.erl is lost, all auxiliary functions
are now moved to aux.erl, and the whole jlib.erl is now deprecated.
2017-03-30 14:17:13 +03:00