registration submit skeleton
This commit is contained in:
parent
cadb95651e
commit
c3e39e895a
2 changed files with 45 additions and 19 deletions
|
@ -1,5 +1,6 @@
|
||||||
angular.module('SeHub')
|
angular.module('SeHub')
|
||||||
.controller('registerController', ['$scope', '$cookies', 'apiService', '$rootScope', function ($scope, $cookies, apiService ,$rootScope) {
|
.controller('registerController', ['$scope', '$cookies', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $location, $mdToast, $mdDialog, apiService ,$rootScope)
|
||||||
|
{
|
||||||
|
|
||||||
$scope.userHasNoName = false;
|
$scope.userHasNoName = false;
|
||||||
$scope.campusChecked = false;
|
$scope.campusChecked = false;
|
||||||
|
@ -16,23 +17,23 @@ angular.module('SeHub')
|
||||||
console.error("No User Found!");
|
console.error("No User Found!");
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
if($scope.user.name === ";"){
|
if($scope.user.name === ";")
|
||||||
|
{
|
||||||
$scope.user.name = "";
|
$scope.user.name = "";
|
||||||
$scope.user.name = $scope.user.username
|
$scope.user.name = $scope.user.username
|
||||||
$scope.userHasNoName = true;
|
$scope.userHasNoName = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
apiService.getAllCampuses($scope.user.seToken).success(function(data) // Get all the campuses
|
apiService.getAllCampuses($scope.user.seToken).success(function(data) // Get all the campuses
|
||||||
{
|
{
|
||||||
$scope.campuses = data;
|
$scope.campuses = data;
|
||||||
}).error(function()
|
}).error(function()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$scope.dropdownClicked = function()
|
$scope.dropdownClicked = function()
|
||||||
{
|
{
|
||||||
if($scope.campus){
|
if($scope.campus){
|
||||||
|
@ -47,26 +48,51 @@ angular.module('SeHub')
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.submitClicked = function()
|
$scope.submitClicked = function(ev)
|
||||||
{
|
{
|
||||||
if($scope.user.AcMail != null)
|
if($scope.user.AcMail != null)
|
||||||
{
|
{
|
||||||
var fullMail = $scope.user.AcMail + $scope.campusObj.email_ending; // Holds the full academic email of the user
|
var fullMail = $scope.user.AcMail + $scope.campusObj.email_ending; // Holds the full academic email of the user
|
||||||
apiService.sendValidationMail($scope.user.seToken, fullMail).success(function(data) // TODO: Add 2nd parameter email type Email
|
apiService.sendValidationMail($scope.user.seToken, fullMail).success(function(data)
|
||||||
{
|
{
|
||||||
console.log("DONE - 200");
|
console.log("DONE - 200");
|
||||||
// TODO - add a window that display that an email has been sent for verification
|
$mdDialog.show($mdDialog.alert().title('E-mail Verification').content('A verification e-mail has been sent to your email address.')
|
||||||
|
.ariaLabel('Email verification alert dialog').ok('Got it!').targetEvent(ev));
|
||||||
|
// TODO - ADD DELETE COOKIES
|
||||||
|
$cookies.remove("com.sehub.www");
|
||||||
|
// $location.path("templates/views/home.html"); // Redirecting to home page // TODO REMOVE REMOVE!!
|
||||||
}).error(function()
|
}).error(function()
|
||||||
{
|
{
|
||||||
// TODO
|
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address.')
|
||||||
|
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(ev));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// TODO FOR LATER
|
||||||
|
// TODO FOR LATER
|
||||||
|
|
||||||
|
$scope.getPopWindowPosition = function()
|
||||||
|
{
|
||||||
|
return Object.keys($scope.toastPosition).filter(function(pos)
|
||||||
|
{
|
||||||
|
return $scope.toastPosition[pos];
|
||||||
|
}).join(' ');
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.toastPosition =
|
||||||
|
{
|
||||||
|
bottom: false,
|
||||||
|
top: true,
|
||||||
|
left: false,
|
||||||
|
right: true
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO FOR LATER
|
||||||
|
// TODO FOR LATER
|
||||||
|
|
||||||
|
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div layout="row" layout-align="center center">
|
<div layout="row" layout-align="center center">
|
||||||
Are You A Lecturer?
|
Are You A Lecturer?
|
||||||
<md-switch ng-model="user.isLecturer" aria-label="Switch 1">
|
<md-switch class="md-primary" md-no-ink aria-label="Switch No Ink" ng-model="data.cb5">
|
||||||
</md-switch>
|
</md-switch>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class = "disabledSubmitButton">
|
<div class = "disabledSubmitButton">
|
||||||
<md-button ng-click="submitClicked()" ng-disabled="!campusChecked" class="md-raised md-primary">Submit</md-button>
|
<md-button ng-click="submitClicked($event)" ng-disabled="!campusChecked" class="md-raised md-primary">Submit</md-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue