- Better error messages for sign up

- Show a throbber while working on sign up
- Have the front page redirect to the repositories view when logged in
This commit is contained in:
Joseph Schorr 2013-10-01 22:13:43 -04:00
parent 211fd6bcd7
commit 31914da4ca
4 changed files with 31 additions and 4 deletions

View file

@ -100,18 +100,29 @@ function RepoListCtrl($scope, Restangular) {
function LandingCtrl($scope, $timeout, Restangular, UserService) {
$('.form-signup').popover();
$('.spin').spin();
$scope.$watch( function () { return UserService.currentUser(); }, function (currentUser) {
$scope.user = currentUser;
if (currentUser && !currentUser.anonymous) {
document.location = '/#/repository';
}
}, true);
$scope.awaitingConfirmation = false;
$scope.registering = false;
$scope.register = function() {
$('.form-signup').popover('hide');
$scope.registering = true;
var newUserPost = Restangular.one('user/');
newUserPost.customPOST($scope.newUser).then(function() {
$scope.awaitingConfirmation = true;
$scope.registering = false;
}, function(result) {
console.log("Displaying error message.");
$scope.registering = false;
$scope.registerError = result.data.message;
$timeout(function() {
$('.form-signup').popover('show');