-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
233 additions
and
45 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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
angular.module('angular-auth', ['http-auth-interceptor', 'content-mocks']) | ||
/** | ||
* This directive will find itself inside HTML as a class, | ||
* and will remove that class, so CSS will remove loading image and show app content. | ||
* It is also responsible for showing/hiding login form. | ||
*/ | ||
.directive('authDemoApplication', function () { | ||
return { | ||
restrict: 'C', | ||
link: function (scope, elem, attrs) { | ||
//once Angular is started, remove class: | ||
elem.removeClass('waiting-for-angular'); | ||
|
||
var login = elem.find('#login-holder'); | ||
var main = elem.find('#content'); | ||
|
||
login.hide(); | ||
|
||
scope.$on('event:auth-loginRequired', function () { | ||
login.slideDown('slow', function () { | ||
main.hide(); | ||
}); | ||
}); | ||
scope.$on('event:auth-loginConfirmed', function () { | ||
main.show(); | ||
login.slideUp(); | ||
}); | ||
} | ||
} | ||
}); | ||
|
||
function LoginCtrl($scope, $http, authService, PersonaAuthenticator) { | ||
|
||
|
||
$scope.submit = function (provider) { | ||
|
||
switch (provider) { | ||
case "persona": | ||
PersonaAuthenticator.login(); | ||
break; | ||
case "google": | ||
login('/security/auth/google_oauth2', 800,600); | ||
break; | ||
default: | ||
throw "Provider not matched"; | ||
} | ||
|
||
//console.info(result); | ||
|
||
//$http.post(path).success(function () { | ||
// authService.loginConfirmed(); | ||
//}); | ||
} | ||
} | ||
LoginCtrl.$inject = ['$scope', '$http', 'authService', 'PersonaAuthenticator']; |
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
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
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,7 +1,7 @@ | ||
class Authorization < ActiveRecord::Base | ||
# no attributes are publicly accessible, all are used only internally | ||
# attr_accessible :link, :name, :provider, :secret, :token, :uid, :user_id | ||
attr_accessible | ||
# to be able to assign values to the attributes, need to expose them here | ||
attr_accessible :link, :name, :provider, :secret, :token, :uid, :user_id | ||
|
||
belongs_to :user | ||
end |