File tree Expand file tree Collapse file tree 2 files changed +24
-7
lines changed Expand file tree Collapse file tree 2 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -62,12 +62,11 @@ var service_name = new InputView({
62
62
* Define fields for each auth method here
63
63
*/
64
64
module . exports = {
65
- DEFAULT : [
65
+ 'SCRAM-SHA-1' : [
66
66
username ,
67
67
password ,
68
68
database_name
69
69
] ,
70
-
71
70
GSSAPI : [
72
71
username ,
73
72
service_name
Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ var ConnectView = View.extend({
150
150
evt . preventDefault ( ) ;
151
151
this . toggle ( 'authOpen' ) ;
152
152
if ( this . authOpen ) {
153
- this . authMethod = this . previousAuthMethod || 'DEFAULT ' ;
153
+ this . authMethod = this . previousAuthMethod || 'SCRAM-SHA-1 ' ;
154
154
} else {
155
155
this . authMethod = null ;
156
156
}
@@ -234,13 +234,31 @@ var ConnectView = View.extend({
234
234
235
235
debug ( 'testing credentials are usable...' ) ;
236
236
model . test ( function ( err ) {
237
- app . statusbar . hide ( ) ;
238
- if ( err ) {
237
+ if ( ! err ) {
238
+ this . onConnectionSuccessful ( model , options ) ;
239
+ return ;
240
+ }
241
+
242
+ if ( model . auth_mechanism !== 'SCRAM-SHA-1' ) {
239
243
debug ( 'failed to connect' , err ) ;
240
244
this . onError ( new Error ( 'Could not connect to MongoDB.' ) , model ) ;
241
245
return ;
242
246
}
243
- this . onConnectionSuccessful ( model , options ) ;
247
+
248
+ // For Kernel 2.6.x
249
+ model . auth_mechanism = 'MONGODB-CR' ;
250
+ debug ( 'trying again w/ MONGODB-CR...' ) ;
251
+ app . statusbar . show ( ) ;
252
+
253
+ model . test ( function ( err ) {
254
+ if ( err ) {
255
+ debug ( 'failed to connect again... bailing' , err ) ;
256
+ this . onError ( new Error ( 'Could not connect to MongoDB.' ) , model ) ;
257
+ return ;
258
+ }
259
+ this . onConnectionSuccessful ( model , options ) ;
260
+ } . bind ( this ) ) ;
261
+
244
262
} . bind ( this ) ) ;
245
263
} ,
246
264
/**
@@ -375,7 +393,7 @@ var ConnectView = View.extend({
375
393
// @todo (imlucas): Consolidate w/ `./auth-fields.js`.
376
394
var authMethods = [
377
395
{
378
- _id : 'DEFAULT ' ,
396
+ _id : 'SCRAM-SHA-1 ' ,
379
397
title : 'User/Password' ,
380
398
enabled : true
381
399
} ,
You can’t perform that action at this time.
0 commit comments