@@ -691,15 +691,15 @@ RED.projects = (function() {
691691 } else {
692692 projectRepoInput . removeClass ( "input-error" ) ;
693693 }
694- if ( / ^ (?: s s h | [ \S ] + ?@ [ \S ] + ?) : (?: \/ \/ ) ? / . test ( repo ) ) {
694+ if ( / ^ h t t p s ? : \/ \/ / . test ( repo ) ) {
695+ $ ( ".projects-dialog-screen-create-row-creds" ) . show ( ) ;
696+ $ ( ".projects-dialog-screen-create-row-sshkey" ) . hide ( ) ;
697+ } else if ( / ^ (?: s s h | [ \S ] + ?@ [ \S ] + ?) : (?: \/ \/ ) ? / . test ( repo ) ) {
695698 $ ( ".projects-dialog-screen-create-row-creds" ) . hide ( ) ;
696699 $ ( ".projects-dialog-screen-create-row-sshkey" ) . show ( ) ;
697700 // if ( !getSelectedSSHKey(projectRepoSSHKeySelect) ) {
698701 // valid = false;
699702 // }
700- } else if ( / ^ h t t p s ? : \/ \/ / . test ( repo ) ) {
701- $ ( ".projects-dialog-screen-create-row-creds" ) . show ( ) ;
702- $ ( ".projects-dialog-screen-create-row-sshkey" ) . hide ( ) ;
703703 } else {
704704 $ ( ".projects-dialog-screen-create-row-creds" ) . hide ( ) ;
705705 $ ( ".projects-dialog-screen-create-row-sshkey" ) . hide ( ) ;
@@ -1509,15 +1509,18 @@ RED.projects = (function() {
15091509 resultCallbackArgs = { error :responses . statusText } ;
15101510 return ;
15111511 } else if ( options . handleAuthFail !== false && xhr . responseJSON . error === 'git_auth_failed' ) {
1512- var url = activeProject . git . remotes [ options . remote || 'origin' ] . fetch ;
1512+ var url = activeProject . git . remotes [ xhr . responseJSON . remote || options . remote || 'origin' ] . fetch ;
15131513
15141514 var message = $ ( '<div>' +
15151515 '<div class="form-row">Authentication required for repository:</div>' +
15161516 '<div class="form-row"><div style="margin-left: 20px;">' + url + '</div></div>' +
15171517 '</div>' ) ;
15181518
15191519 var isSSH = false ;
1520- if ( / ^ (?: s s h | [ \d \w \. \- _ ] + @ [ \w \. ] + ) : (?: \/ \/ ) ? / . test ( url ) ) {
1520+ if ( / ^ h t t p s ? : \/ \/ / ) {
1521+ $ ( '<div class="form-row"><label for="projects-user-auth-username">Username</label><input id="projects-user-auth-username" type="text"></input></div>' +
1522+ '<div class="form-row"><label for=projects-user-auth-password">Password</label><input id="projects-user-auth-password" type="password"></input></div>' ) . appendTo ( message ) ;
1523+ } else if ( / ^ (?: s s h | [ \d \w \. \- _ ] + @ [ \w \. ] + ) : (?: \/ \/ ) ? / . test ( url ) ) {
15211524 isSSH = true ;
15221525 var row = $ ( '<div class="form-row"></div>' ) . appendTo ( message ) ;
15231526 $ ( '<label for="projects-user-auth-key">SSH Key</label>' ) . appendTo ( row ) ;
@@ -1535,9 +1538,6 @@ RED.projects = (function() {
15351538 row = $ ( '<div class="form-row"></div>' ) . appendTo ( message ) ;
15361539 $ ( '<label for="projects-user-auth-passphrase">Passphrase</label>' ) . appendTo ( row ) ;
15371540 $ ( '<input id="projects-user-auth-passphrase" type="password"></input>' ) . appendTo ( row ) ;
1538- } else {
1539- $ ( '<div class="form-row"><label for="projects-user-auth-username">Username</label><input id="projects-user-auth-username" type="text"></input></div>' +
1540- '<div class="form-row"><label for=projects-user-auth-password">Password</label><input id="projects-user-auth-password" type="password"></input></div>' ) . appendTo ( message ) ;
15411541 }
15421542
15431543 var notification = RED . notify ( message , {
@@ -1575,7 +1575,7 @@ RED.projects = (function() {
15751575
15761576 }
15771577 sendRequest ( {
1578- url : "projects/" + activeProject . name + "/remotes/" + ( options . remote || 'origin' ) ,
1578+ url : "projects/" + activeProject . name + "/remotes/" + ( xhr . responseJSON . remote || options . remote || 'origin' ) ,
15791579 type : "PUT" ,
15801580 responses : {
15811581 0 : function ( error ) {
0 commit comments