1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00

Add support for Redis 6 auth pass [user] (#1508)

* Add support for `auth pass user`

* fix lint issues

* fix typo

* fix more lint issues

* more lints fixes

* reverse password user order

* update redis-commands

* Update individualCommands.js

Clean code

* Update individualCommands.js

* Update auth.spec.js

* Update index.js

Co-authored-by: Leibale Eidelman <leibale1998@gmail.com>
This commit is contained in:
Guy Korland
2021-03-18 01:21:37 +02:00
committed by GitHub
parent bb208d0b9d
commit 428e1c8a7b
4 changed files with 26 additions and 9 deletions

View File

@@ -29,7 +29,11 @@ module.exports = function createClient (port_arg, host_arg, options) {
// [redis:]//[[user][:password]@][host][:port][/db-number][?db=db-number[&password=bar[&option=value]]]
if (parsed.slashes) { // We require slashes
if (parsed.auth) {
options.password = parsed.auth.slice(parsed.auth.indexOf(':') + 1);
var columnIndex = parsed.auth.indexOf(':');
options.password = parsed.auth.slice(columnIndex + 1);
if (columnIndex > 0) {
options.user = parsed.auth.slice(0, columnIndex);
}
}
if (parsed.protocol) {
if (parsed.protocol === 'rediss:') {