- fixed mdDialog on email error
This commit is contained in:
parent
b3dc506d49
commit
37880d649a
3 changed files with 30 additions and 40 deletions
|
@ -56,9 +56,13 @@ angular.module('SeHub')
|
|||
|
||||
$scope.submitClicked = function(ev)
|
||||
{
|
||||
var emailValid = false;
|
||||
if($scope.user.AcMail != null)
|
||||
{
|
||||
var fullMail = $scope.user.AcMail + $scope.campusObj.email_ending; // Holds the full academic email of the user
|
||||
|
||||
console.log("Mail: " + fullMail);
|
||||
|
||||
apiService.sendValidationMail($scope.user.seToken, fullMail).success(function(data)
|
||||
{
|
||||
console.log("DONE - 200");
|
||||
|
@ -72,36 +76,38 @@ angular.module('SeHub')
|
|||
$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));
|
||||
});
|
||||
}
|
||||
else // TODO Fix when success to show mdDialog until 'Got it' clicked
|
||||
{
|
||||
$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));
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
$scope.createCampus = function(ev)
|
||||
{
|
||||
$scope.createCampusClicked = true;
|
||||
|
||||
if(!$scope.isLecturer) // "!isLecturer" Means => I Am Lecturer; if i am a lecturer (when pressing -> getting last data value before pressing)
|
||||
{
|
||||
if($scope.user.campusSuffixMail != null)
|
||||
if($scope.user.campusMail != null)
|
||||
{
|
||||
validateEmail($scope.user.campusSuffixMail);
|
||||
validateEmail($scope.user.campusMail); // Verify the email according to "xxx@name.suffix"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
validateEmail = function(email) // TODO ADD IT
|
||||
validateEmail = function(email)
|
||||
{
|
||||
var result = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
|
||||
|
||||
console.log("Email: " + email);
|
||||
|
||||
if (!result.test(email))
|
||||
if (!result.test(email)) // TODO Fix when success to show mdDialog until 'Got it' clicked
|
||||
{
|
||||
console.log(email + ", Error in email, should alert");
|
||||
alert('Please provide a valid e-mail address');
|
||||
// alert('Please provide a valid e-mail address');
|
||||
$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(email));
|
||||
}
|
||||
|
||||
if(result.test(email))
|
||||
if(result.test(email)) // TODO Fix when success to show mdDialog until 'Got it' clicked
|
||||
{
|
||||
console.log("Im good");
|
||||
apiService.sendValidationMail($scope.user.seToken, email).success(function(data)
|
||||
|
@ -119,26 +125,4 @@ angular.module('SeHub')
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
// TODO FOR LATER - toast
|
||||
// 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
|
||||
}]);
|
||||
|
|
|
@ -3,8 +3,6 @@ var DEBUG = true;
|
|||
var service = angular.module('seHub.services', []);
|
||||
|
||||
service.factory('apiService', ['$http', function($http) {
|
||||
|
||||
|
||||
return {
|
||||
getUserByToken: function(token){
|
||||
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/getUserByToken/" + token;
|
||||
|
@ -36,9 +34,17 @@ service.factory('apiService', ['$http', function($http) {
|
|||
data: payload
|
||||
};
|
||||
|
||||
return $http(req);
|
||||
},
|
||||
updateUser: function(token, payLoad){
|
||||
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/updateUser/" + token;
|
||||
|
||||
req = {
|
||||
method: "POST",
|
||||
url: url,
|
||||
data: payLoad
|
||||
};
|
||||
return $http(req);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}]);
|
|
@ -12,7 +12,7 @@
|
|||
<div>
|
||||
<md-input-container ng-if="userHasNoName">
|
||||
<label>Full Name: </label>
|
||||
<input ng-model="user.name" required>
|
||||
<input ng-model="user.name" ng-minlength="1" required>
|
||||
</md-input-container>
|
||||
</div>
|
||||
<br></br>
|
||||
|
@ -29,7 +29,7 @@
|
|||
<div class = "createCampus" ng-if="createCampusClicked">
|
||||
<md-input-container>
|
||||
<label>Academic Suffix Email</label>
|
||||
<input type="text" ng-model="user.campusSuffixMail" ng-minlength="1" required/>
|
||||
<input type="text" ng-model="user.campusMail" ng-minlength="1" required/>
|
||||
</md-input-container>
|
||||
<md-input-container>
|
||||
<label>Campus Name</label>
|
||||
|
@ -65,7 +65,7 @@
|
|||
<div>
|
||||
<md-input-container>
|
||||
<label>Academic Email</label>
|
||||
<input type="text" ng-model="user.AcMail" required/>
|
||||
<input type="text" ng-model="user.AcMail" ng-length="1" required/>
|
||||
</md-input-container>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue