@@ -1000,16 +1000,16 @@ class TcpConnection extends Connection
1000
1000
1001
1001
r_string = new Buffer (crypto .randomBytes (18 )).toString (' base64' )
1002
1002
1003
- @rawSocket .username = host[" username " ]
1003
+ @rawSocket .user = host[" user " ]
1004
1004
@rawSocket .password = host[" password" ]
1005
1005
1006
1006
# Default to admin user with no password if none is given.
1007
- if @rawSocket .username is undefined
1008
- @rawSocket .username = " admin"
1007
+ if @rawSocket .user is undefined
1008
+ @rawSocket .user = " admin"
1009
1009
if @rawSocket .password is undefined
1010
1010
@rawSocket .password = " "
1011
1011
1012
- client_first_message_bare = " n=" + @rawSocket .username + " ,r=" + r_string
1012
+ client_first_message_bare = " n=" + @rawSocket .user + " ,r=" + r_string
1013
1013
1014
1014
message = JSON .stringify ({
1015
1015
protocol_version : protoVersionNumber,
@@ -1636,11 +1636,17 @@ module.exports.connect = varar 0, 2, (hostOrCallback, callback) ->
1636
1636
# 2. Initializes the connection, and when it's complete invokes
1637
1637
# the user's callback
1638
1638
new Promise ( (resolve , reject ) ->
1639
- if host .authKey ? && (host .password ? || host .user ? )
1639
+ if host .authKey ? && (host .password ? || host .user ? || host . username ? )
1640
1640
throw new err.ReqlDriverError " Cannot use both authKey and password"
1641
+ if host .user && host .username
1642
+ throw new err.ReqlDriverError " Cannot use both user and username"
1641
1643
else if host .authKey
1642
1644
host .user = " admin"
1643
1645
host .password = host .authKey
1646
+ else
1647
+ # Fixing mismatch between drivers
1648
+ if host .username ?
1649
+ host .user = host .username
1644
1650
create_connection = (host , callback ) =>
1645
1651
if TcpConnection .isAvailable ()
1646
1652
new TcpConnection host, callback
0 commit comments