Skip to content

Commit

Permalink
fix bug in social login + username in guest login
Browse files Browse the repository at this point in the history
  • Loading branch information
ygalbel committed Feb 16, 2016
0 parents commit 83538fc
Show file tree
Hide file tree
Showing 149 changed files with 204,376 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/backand-ionic-starter.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

436 changes: 436 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

7,016 changes: 7,016 additions & 0 deletions css/ionic.app.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions css/ionic.app.min.css

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions css/style.css
@@ -0,0 +1,21 @@
/* Empty. Add your own CSS if you like */
.icon.new-item {
position: absolute;
right: 20px;
font-size: 20px;
bottom: 13px;
}
.cancel-create {
position: absolute;
right: 20px;
font-size: 14px;
bottom: 13px;
color:#ef4e3a;
}
[ng-click], [data-ng-click], [x-ng-click] {
cursor: pointer;
}
/* Ionic Overwrite! */
.item-icon-left .icon, .item-icon-right .icon {
font-size: 22px;
}
Binary file added img/ionic.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions index.html
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>

<link href="lib/ionic/css/ionic.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->

<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.min.js"></script>

<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>

<script src="lib/angularbknd-sdk/dist/backand.debug.js"></script>

<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/services.js"></script>

</head>
<body ng-app="SimpleRESTIonic">
<!--
The nav bar that will be updated as we navigate between views.
-->
<ion-nav-bar class="bar-stable">
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<!--
The views will be rendered in the <ion-nav-view> directive below
Templates are in the /templates folder (but you could also
have templates inline in this html file if you'd like).
-->
<ion-nav-view></ion-nav-view>
</body>
</html>
Binary file added js/.DS_Store
Binary file not shown.
105 changes: 105 additions & 0 deletions js/app.js
@@ -0,0 +1,105 @@
// Ionic template App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'SimpleRESTIonic' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
angular.module('SimpleRESTIonic', ['ionic', 'backand', 'SimpleRESTIonic.controllers', 'SimpleRESTIonic.services'])

/* .run(function (, Backand) {
})
*/
.config(function (BackandProvider, $stateProvider, $urlRouterProvider, $httpProvider) {
// change here to your appName
BackandProvider.setAppName('ionicstarter');

BackandProvider.setSignUpToken('4ce88904-75c5-412c-8365-df97d9e18a8f');

// token is for anonymous login. see http://docs.backand.com/en/latest/apidocs/security/index.html#anonymous-access
BackandProvider.setAnonymousToken('87c37623-a2d2-42af-93df-addc65c6e9ad');

$stateProvider
// setup an abstract state for the tabs directive
.state('tab', {
url: '/tabs',
abstract: true,
templateUrl: 'templates/tabs.html'
})
.state('tab.dashboard', {
url: '/dashboard',
views: {
'tab-dashboard': {
templateUrl: 'templates/tab-dashboard.html',
controller: 'DashboardCtrl as vm'
}
}
})
.state('tab.login', {
url: '/login',
views: {
'tab-login': {
templateUrl: 'templates/tab-login.html',
controller: 'LoginCtrl as login'
}
}
})
.state('tab.signup', {
url: '/signup',
views: {
'tab-signup': {
templateUrl: 'templates/tab-signup.html',
controller: 'SignUpCtrl as vm'
}
}
}
);

$urlRouterProvider.otherwise('/tabs/dashboard');
$httpProvider.interceptors.push('APIInterceptor');
})

.run(function ($ionicPlatform, $rootScope, $state, LoginService, Backand) {

$ionicPlatform.ready(function () {

// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}

if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleLightContent();
}


var isMobile = !(ionic.Platform.platforms[0] == "browser");
Backand.setIsMobile(isMobile);
Backand.setRunSignupAfterErrorInSigninSocial(true);
});

function unauthorized() {
console.log("user is unauthorized, sending to login");
$state.go('tab.login');
}

function signout() {
LoginService.signout();
}

$rootScope.$on('unauthorized', function () {
unauthorized();
});

$rootScope.$on('$stateChangeSuccess', function (event, toState) {
if (toState.name == 'tab.login') {
signout();
}
else if (toState.name != 'tab.login' && Backand.getToken() === undefined) {
unauthorized();
}
});

})

0 comments on commit 83538fc

Please sign in to comment.