1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +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

@@ -109,6 +109,7 @@ function RedisClient (options, stream) {
this.closing = false;
this.server_info = {};
this.auth_pass = options.auth_pass || options.password;
this.auth_user = options.auth_user || options.user;
this.selected_db = options.db; // Save the selected db here, used when reconnecting
this.fire_strings = true; // Determine if strings or buffers should be written to the stream
this.pipeline = false;
@@ -240,7 +241,7 @@ RedisClient.prototype.create_stream = function () {
if (this.auth_pass !== undefined) {
this.ready = true;
// Fail silently as we might not be able to connect
this.auth(this.auth_pass, function (err) {
this.auth(this.auth_pass, this.auth_user, function (err) {
if (err && err.code !== 'UNCERTAIN_STATE') {
self.emit('error', err);
}