@@ -51,12 +51,16 @@ function wwwFormUrlEncode (aStr) {
5151 . replace ( / \@ / g, '%40' ) ;
5252}
5353
54+ function validURL ( value ) {
55+ return / ^ (?: (?: (?: h t t p s ? | f t p ) : ) ? \/ \/ ) (?: \S + (?: : \S * ) ? @ ) ? (?: (? ! (?: 1 0 | 1 2 7 ) (?: \. \d { 1 , 3 } ) { 3 } ) (? ! (?: 1 6 9 \. 2 5 4 | 1 9 2 \. 1 6 8 ) (?: \. \d { 1 , 3 } ) { 2 } ) (? ! 1 7 2 \. (?: 1 [ 6 - 9 ] | 2 \d | 3 [ 0 - 1 ] ) (?: \. \d { 1 , 3 } ) { 2 } ) (?: [ 1 - 9 ] \d ? | 1 \d \d | 2 [ 0 1 ] \d | 2 2 [ 0 - 3 ] ) (?: \. (?: 1 ? \d { 1 , 2 } | 2 [ 0 - 4 ] \d | 2 5 [ 0 - 5 ] ) ) { 2 } (?: \. (?: [ 1 - 9 ] \d ? | 1 \d \d | 2 [ 0 - 4 ] \d | 2 5 [ 0 - 4 ] ) ) | (?: (?: [ a - z \u00a1 - \uffff 0 - 9 ] - * ) * [ a - z \u00a1 - \uffff 0 - 9 ] + ) (?: \. (?: [ a - z \u00a1 - \uffff 0 - 9 ] - * ) * [ a - z \u00a1 - \uffff 0 - 9 ] + ) * (?: \. (?: [ a - z \u00a1 - \uffff ] { 2 , } ) ) ) (?: : \d { 2 , 5 } ) ? (?: [ / ? # ] \S * ) ? $ / i. test ( value ) ;
56+ }
57+
5458/**
5559 * Our Nextcloud Provider
5660 */
5761function Nextcloud ( ) {
58- //this.log = Log4Moz.getConfiguredLogger("Nextcloud", Log4Moz.Level.Info, Log4Moz.Level.Debug,
59- // Log4Moz.Level.Debug);
62+ // this.log = Log4Moz.getConfiguredLogger("Nextcloud", Log4Moz.Level.Info, Log4Moz.Level.Debug,
63+ // Log4Moz.Level.Debug);
6064 this . log = Log4Moz . getConfiguredLogger ( "Nextcloud" ) ;
6165}
6266
@@ -379,7 +383,7 @@ Nextcloud.prototype = {
379383 ] ,
380384 2 ) ;
381385
382- if ( authPrompter . promptPassword (
386+ if ( validURL ( serverUrl ) && authPrompter . promptPassword (
383387 this . displayName ,
384388 promptString ,
385389 serverUrl ,
@@ -411,8 +415,15 @@ Nextcloud.prototype = {
411415 logon : function nsNc_logon ( successCallback , failureCallback , aWithUI ) {
412416 this . log . info ( "Logging in, aWithUI = " + aWithUI ) ;
413417
414- if ( this . _password == undefined || ! this . _password )
418+ if ( this . _password == undefined || ! this . _password ) {
415419 this . _password = this . getPassword ( this . _userName , ! aWithUI ) ;
420+ }
421+
422+ if ( this . _password == "" ) {
423+ this . log . error ( 'Could not retrieve password' ) ;
424+ this . _loggedIn = false ;
425+ failureCallback ( ) ;
426+ }
416427
417428 this . log . info ( "Sending login information..." ) ;
418429
0 commit comments