File tree Expand file tree Collapse file tree 5 files changed +5
-22
lines changed Expand file tree Collapse file tree 5 files changed +5
-22
lines changed Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ angular.module('mm.core.contentlinks')
174174 // Get the site URL.
175175 var siteUrl = $mmContentLinksDelegate . getSiteUrl ( url ) ,
176176 formatted = $mmUtil . formatURL ( siteUrl ) ;
177- if ( ! siteUrl || ! $mmUtil . isValidURL ( formatted ) ) {
177+ if ( ! siteUrl ) {
178178 $mmUtil . showErrorModal ( 'mm.login.invalidsite' , true ) ;
179179 return ;
180180 }
Original file line number Diff line number Diff line change @@ -25,23 +25,6 @@ angular.module('mm.core.login')
2525 $ionicModal , $mmLoginHelper ) {
2626
2727 $scope . siteurl = '' ;
28- $scope . isInvalidUrl = true ;
29-
30- $scope . validate = function ( url ) {
31- if ( ! url ) {
32- $scope . isInvalidUrl = true ;
33- return ;
34- }
35-
36- if ( $mmSitesManager . getDemoSiteData ( url ) ) {
37- // Is demo site.
38- $scope . isInvalidUrl = false ;
39- } else {
40- // formatURL adds the protocol if is missing.
41- var formattedurl = $mmUtil . formatURL ( url ) ;
42- $scope . isInvalidUrl = formattedurl . indexOf ( '://localhost' ) == - 1 && ! $mmUtil . isValidURL ( formattedurl ) ;
43- }
44- } ;
4528
4629 $scope . connect = function ( url ) {
4730
Original file line number Diff line number Diff line change 88 < form >
99 < label class ="item item-input item-stacked-label ">
1010 < span class ="input-label "> {{ 'mm.login.siteaddress' | translate }}</ span >
11- < input type ="url " placeholder ="moodle.org " ng-model ="siteurl " mm-no-input-validation ng-change =" validate(siteurl) " mm-auto-focus >
11+ < input type ="url " placeholder ="moodle.org " ng-model ="siteurl " mm-no-input-validation mm-auto-focus >
1212 </ label >
1313 < div class ="item ">
14- < button class ="button button-block " ng-click ="connect(siteurl) " ng-disabled ="isInvalidUrl "> {{ 'mm.login.connect' | translate }}</ button >
14+ < button class ="button button-block " ng-click ="connect(siteurl) " ng-disabled ="!siteurl "> {{ 'mm.login.connect' | translate }}</ button >
1515 <!-- <input type="submit" class="button button-block" value="{{ 'mm.login.connect' | translate }}" > -->
1616 </ div >
1717 </ form >
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ angular.module('mm.core')
8686 // formatURL adds the protocol if is missing.
8787 siteurl = $mmUtil . formatURL ( siteurl ) ;
8888
89- if ( siteurl . indexOf ( '://localhost' ) == - 1 && ! $mmUtil . isValidURL ( siteurl ) ) {
89+ if ( ! $mmUtil . isValidURL ( siteurl ) ) {
9090 return $mmLang . translateAndReject ( 'mm.login.invalidsite' ) ;
9191 } else if ( ! $mmApp . isOnline ( ) ) {
9292 return $mmLang . translateAndReject ( 'mm.core.networkerrormsg' ) ;
Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ angular.module('mm.core')
214214 * FALSE otherwise.
215215 */
216216 self . isValidURL = function ( url ) {
217- return / ^ h t t p ( s ) ? \: \/ \/ ( [ \d a - z A - Z \. - ] + ) \. ( [ \d a - z A - Z \. ] { 2 , 6 } ) ( [ \/ \w \. - ] * ) * \/ ? / i. test ( url ) ;
217+ return / ^ h t t p ( s ) ? \: \/ \/ . + / i. test ( url ) ;
218218 } ;
219219
220220 /**
You can’t perform that action at this time.
0 commit comments