aboutsummaryrefslogtreecommitdiffstats
path: root/util/sasl/anonymous.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-05-29 06:52:56 +0200
committerKim Alvefur <zash@zash.se>2018-05-29 06:52:56 +0200
commit1568beb1d8576b081eb4b785d1c6d31aa21bccd9 (patch)
tree8f649a71abd21b94306f1e33712c6565b1331dd0 /util/sasl/anonymous.lua
parent6fca546a68e5316421cd23f5b7763e3670895b2f (diff)
downloadprosody-1568beb1d8576b081eb4b785d1c6d31aa21bccd9.tar.gz
prosody-1568beb1d8576b081eb4b785d1c6d31aa21bccd9.zip
util.sasl.anonymous: Generate shorter random usernames
Diffstat (limited to 'util/sasl/anonymous.lua')
-rw-r--r--util/sasl/anonymous.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/sasl/anonymous.lua b/util/sasl/anonymous.lua
index 88e13b40..a5b0f749 100644
--- a/util/sasl/anonymous.lua
+++ b/util/sasl/anonymous.lua
@@ -12,7 +12,7 @@
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-local generate_uuid = require "util.uuid".generate;
+local generate_random_id = require "util.id".long;
local _ENV = nil;
-- luacheck: std none
@@ -32,7 +32,7 @@ anonymous:
local function anonymous(self, message) -- luacheck: ignore 212/message
local username;
repeat
- username = generate_uuid();
+ username = generate_random_id():lower();
until self.profile.anonymous(self, username, self.realm);
self.username = username;
return "success"