-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
89 lines (73 loc) · 2.92 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" ng-app="oauthioApp" ng-controller="AppCtrl"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" ng-app="oauthioApp" ng-controller="AppCtrl"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" ng-app="oauthioApp" ng-controller="AppCtrl"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" ng-app="oauthioApp" ng-controller="AppCtrl"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>angular-oauthio-login test</title>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
<!-- one from bower doesn't transfer fonts with correct MIME type -->
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<style>
[ng-click],
[data-ng-click],
[x-ng-click] {
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<h1>angular-oauthio-login test</h1>
<div class="alert alert-danger" ng-show="keyError">You have to enter your OAuth.io public key for the test app to work!</div>
<h2 ng-show="oauthUser.user">Logged in user: {{oauthUser.user.name}}</h2>
<h2 ng-show="oauthUser.error">Error: {{oauthUser.error.message}}</h2>
<div ng-show="oauthUser"><a ng-click="oauthUser = null">Log out</a></div>
<div ng-repeat="(provider,icon) in providers">
<h2>{{provider}}</h2>
<div drr-oauthio-login
data-on-login="login(endpoint,user,provider,error)"
data-oauth-provider="{{provider}}"
data-provider-icon="{{icon}}"
data-oauthio-key="{{oauthioKey}}">
</div>
</div>
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/oauth-js/dist/oauth.js"></script>
<script src="oauthio-login.js"></script>
<script>
angular.module('oauthioApp', ['resseguie.angular-oauthio-login']);
angular.module('oauthioApp')
.controller('AppCtrl',['$scope',function($scope){
//
// TODO Put your OAuth.io public key here for testing
//
$scope.oauthioKey = 'MpnCNnhVAq_zL089ua883AevC1o';
// Sample providers for test app and icon to use on button
$scope.providers = {
'Twitter' : 'twitter-square',
'Facebook' : 'facebook-square',
'GitHub' : 'github-square',
'LinkedIn' : 'linkedin-square',
'Google' : 'google-plus-square'
};
$scope.$watch('oauthioKey',function(value){
$scope.keyError = (value == '<your public OAuth.io key here>');
});
$scope.login = function(endpoint,user,provider,error){
$scope.oauthUser = {
endpoint: endpoint,
user: user,
provider: provider,
error: error
};
}
}]);
</script>
</div>
</body>
</html>