-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from clevertech/feature/auth
feat(auth), arch(requirejs)
- Loading branch information
Showing
25 changed files
with
1,078 additions
and
886 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,6 @@ dist | |
app/components | ||
test-results.xml | ||
.DS_Store | ||
docs/* | ||
docs/* | ||
libpeerconnection.log | ||
*.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
define(['angular'],function (angular) { | ||
|
||
'use strict'; | ||
|
||
var services = angular.module('app.services', | ||
[ 'ngResource', | ||
'http-auth-interceptor' | ||
]); | ||
|
||
var directives = angular.module('app.directives', | ||
[ | ||
]); | ||
|
||
var filters = angular.module('app.filters', | ||
[ | ||
]); | ||
|
||
var resources = angular.module('app.resources', | ||
[ | ||
]); | ||
|
||
var app = angular.module('app', | ||
[ 'app.services', | ||
'app.directives', | ||
'app.filters', | ||
'app.resources' | ||
]); | ||
|
||
return app; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
define(['angular', 'app'], function (angular, app) { | ||
'use strict'; | ||
|
||
app.config( | ||
['$locationProvider', '$httpProvider', '$authProvider', | ||
function ($locationProvider, $httpProvider, $authProvider) { | ||
|
||
$httpProvider.defaults.withCredentials = true; | ||
$locationProvider.html5Mode( true ); | ||
}]); | ||
|
||
// Initialize $auth | ||
// app.run(['$auth', '$resourceFactory', | ||
// function ($auth, $resourceFactory) { | ||
// You can register your resources here | ||
// $resourceFactory('Resource#1') | ||
// $resourceFactory('Resource#2') | ||
// After this, they will be available to be injected | ||
// in your controllers like regular services. | ||
// }]); | ||
// | ||
app.run(['$auth', '$debug', function ($auth, $debug) { | ||
}]); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Empty file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,6 @@ | ||
var app = angular.module('app'); | ||
|
||
app.controller( 'HomeCtrl', | ||
['$scope', | ||
function( $scope ) { | ||
|
||
'use strict'; | ||
|
||
$scope.welcome = 'Hello!'; | ||
|
||
$scope.awesomeThings = [1,2,3]; | ||
|
||
}]); | ||
define(['app'], function (app) { | ||
'use strict'; | ||
app.controller('Home', ['$scope', function ($scope) { | ||
$scope.welcome = "Hello there!"; | ||
}]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
define(['app'], function (app) { | ||
'use strict'; | ||
|
||
app.controller('Login', ['$scope','$auth', function ($scope, $auth) { | ||
$scope.login = function () { | ||
$auth.login($scope.credentials); | ||
} | ||
|
||
$scope.$on('$auth:loginFailure', function (event, data) { | ||
console.log("LoginController:",event,data); | ||
if(data === '403') { | ||
alert('Invalid username/password'); | ||
} | ||
}); | ||
|
||
}]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
define(['app'], function (app) { | ||
'use strict'; | ||
|
||
app.controller('Users', ['$scope', '$auth', function ($scope, $auth) { | ||
|
||
$scope.welcome = "This is a private area."; | ||
|
||
}]); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Empty file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,47 @@ | ||
var directives = angular.module('ngSeed.directives'); | ||
|
||
/** | ||
* @ngdoc directive | ||
* @name ngSeed.directives:string2number | ||
* @description | ||
* Converts a string to a number. Useful in type="number" input | ||
* elements that bind to a stringified number model. | ||
*/ | ||
directives.directive('string2number', function() { | ||
|
||
define(['angular', 'app'], function (angular) { | ||
'use strict'; | ||
|
||
return { | ||
restrict: 'A', | ||
require: 'ngModel', | ||
link: function(scope, element, attr, ngModel) { | ||
/** | ||
* @ngdoc directive | ||
* @name ngSeed.directives:string2number | ||
* @description | ||
* Converts a string to a number. Useful in type="number" input | ||
* elements that bind to a stringified number model. | ||
*/ | ||
angular | ||
.module('app.directives') | ||
.directive('string2number', function() { | ||
|
||
return { | ||
restrict: 'A', | ||
require: 'ngModel', | ||
link: function(scope, element, attr, ngModel) { | ||
|
||
/** | ||
* @ngdoc method | ||
* @name fromField | ||
* @methodOf ngSeed.directives:string2number | ||
* @param {Number, String} number Just the number that has been input. | ||
* @return {Number} The number. | ||
*/ | ||
function fromField(number) { | ||
return Number(number); | ||
} | ||
|
||
/** | ||
* @ngdoc method | ||
* @name fromField | ||
* @methodOf ngSeed.directives:string2number | ||
* @param {Number, String} number Just the number that has been input. | ||
* @return {Number} The number. | ||
*/ | ||
function fromField(number) { | ||
return Number(number); | ||
} | ||
/** | ||
* @ngdoc method | ||
* @name toField | ||
* @methodOf ngSeed.directives:string2number | ||
* @param {Number, String} number Just the number that has been input. | ||
* @return {Number} The number or 0. | ||
*/ | ||
function toField(text) { | ||
return Number(text || 0); | ||
} | ||
ngModel.$parsers.push(fromField); | ||
ngModel.$formatters.push(toField); | ||
} | ||
}; | ||
}); | ||
|
||
/** | ||
* @ngdoc method | ||
* @name toField | ||
* @methodOf ngSeed.directives:string2number | ||
* @param {Number, String} number Just the number that has been input. | ||
* @return {Number} The number or 0. | ||
*/ | ||
function toField(text) { | ||
return Number(text || 0); | ||
} | ||
ngModel.$parsers.push(fromField); | ||
ngModel.$formatters.push(toField); | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Empty file |
Oops, something went wrong.