Skip to content

Commit

Permalink
Added social login dummy
Browse files Browse the repository at this point in the history
  • Loading branch information
zakhenry committed Jul 22, 2015
1 parent 82bfa79 commit 0298fa5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
7 changes: 7 additions & 0 deletions app/src/app/_partials/registration/registration.tpl.html
@@ -1,5 +1,12 @@
<h2>Register</h2>


Login with:

<md-button class="md-fab" aria-label="Register with Facebook" ng-click="socialLogin('facebook', 'app.user.profile', {onBoard: true})">
<md-icon>account_box</md-icon>
</md-button>

<form novalidate name="registrationForm">

<fieldset ng-disabled="submitting">
Expand Down
21 changes: 18 additions & 3 deletions app/src/app/_partials/registration/registration.ts
Expand Up @@ -4,17 +4,19 @@ module app.partials.registration{

export interface IScope extends ng.IScope
{
registerUser(email:string, password:string, first:string, last:string, goToProfile?:boolean)
registerUser(email:string, password:string, first:string, last:string, goToProfile?:boolean);
submitting:boolean;
socialLogin(type:string, redirectState?:string, redirectStateParams?:Object);
}

class RegistrationController {

static $inject = ['$scope', 'userService', '$state'];
static $inject = ['$scope', 'userService', '$state', '$window'];
constructor(
private $scope:IScope,
private userService:common.services.UserService,
private $state:ng.ui.IStateService
private $state:ng.ui.IStateService,
private $window:ng.IWindowService
) {

$scope.submitting = false;
Expand All @@ -39,6 +41,19 @@ module app.partials.registration{
$scope.submitting = false;
})
;
};


$scope.socialLogin = (type:string, redirectState?:string, redirectStateParams:Object = {}) => {

let url = '/auth/social/'+type;

if (!_.isEmpty(redirectState)){
url += '?returnUrl='+(<any>this.$window).encodeURIComponent(this.$state.href(redirectState, redirectStateParams));
}

this.$window.location.href = url;

}

}
Expand Down

0 comments on commit 0298fa5

Please sign in to comment.