Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #101 from AppliedIS/feature-adminroles
Browse files Browse the repository at this point in the history
email verification and check image
  • Loading branch information
jefferey committed Nov 4, 2016
2 parents 2ba2361 + fa4fe97 commit b6acd71
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 46 deletions.
Binary file added DOL.WHD.Section14c.Web/src/images/correct9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ module.exports = function(ngModule) {
vm.passwordsDontMatch = false;
vm.passwordComplexity = false;
vm.accountCreated = false;
vm.emailVerified = false;
vm.emailVerificationError = false;
}
vm.resetErrors();

Expand Down Expand Up @@ -65,6 +67,18 @@ module.exports = function(ngModule) {
vm.emailVerificationUserId = $location.search().userId;
vm.isEmailVerificationRequest = vm.emailVerificationCode !== undefined && vm.emailVerificationCode !== undefined

if(vm.isEmailVerificationRequest){
$location.search('code', null);
$location.search('userId', null);
vm.resetErrors();
apiService.emailVerification(vm.emailVerificationUserId, vm.emailVerificationCode, $scope.verifyResponse).then(function (result) {
vm.emailVerified = true;
}, function (error) {
vm.emailVerificationError = true;
console.log(error.statusText + (error.data && error.data.error ? ': ' + error.data.error + ' - ' + error.data.error_description : ''));
});
}

$scope.onSubmitClick = function() {
vm.resetErrors();
vm.registerdEmail = ''
Expand Down Expand Up @@ -113,8 +127,6 @@ module.exports = function(ngModule) {

$scope.regResponse = null;
$scope.regWidgetId = null;
$scope.verifyResponse = null;
$scope.verifyWidgetId = null;
$scope.model = {
key: _env.reCaptchaSiteKey
};
Expand All @@ -131,41 +143,12 @@ module.exports = function(ngModule) {
vcRecaptchaService.reload($scope.regWidgetId);
$scope.regResponse = null;
};
$scope.setVerifyResponse = function (response) {
console.info('Response available');
$scope.verifyResponse = response;
};
$scope.createVerifyWidget = function (widgetId) {
console.info('Created widget ID: %s', widgetId);
$scope.verifyWidgetId = widgetId;
};
$scope.resetVerifyCaptcha = function() {
console.info('Captcha expired/reset. Resetting response object');
vcRecaptchaService.reload($scope.verifyWidgetId);
$scope.verifyResponse = null;
};


$scope.hideShowPassword = function(){
if ($scope.inputType === 'password')
$scope.inputType = 'text';
else
$scope.inputType = 'password';
};

$scope.onVerifyClick = function() {
$location.search('code', null);
$location.search('userId', null);
vm.resetErrors();
apiService.emailVerification(vm.emailVerificationUserId, vm.emailVerificationCode, $scope.verifyResponse).then(function (result) {
//TODO: show success
$location.path("/");
}, function (error) {
console.log(error.statusText + (error.data && error.data.error ? ': ' + error.data.error + ' - ' + error.data.error_description : ''));
//vcRecaptchaService.reload($scope.widgetId);
$location.path("/");
});
}

});
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
</ul>
<p>Read our <a>FAQs for Electronic Section 14(c) Certificate Application</a></p>
<hr/>
</div>
<div>
<div class="usa-alert usa-alert-success" role="alert" ng-show="vm.accountCreated">
<div class="usa-alert-body">
<h3 class="usa-alert-heading">Account Created</h3>
Expand Down Expand Up @@ -112,18 +110,20 @@ <h3 class="usa-alert-heading">Passwords must</h3>
></div>
</div>
<div class="regbtn"><button type="submit">Register</button></div>
</div>
</form>
<div ng-show="vm.isEmailVerificationRequest">
<h2>Verify Email</h2>
<div
vc-recaptcha
theme="'light'"
key="model.key"
on-create="createVerifyWidget(widgetId)"
on-success="setVerifyResponse(response)"
on-expire="resetVerifyCaptcha()"
></div>
<div><button type="submit" ng-click="onVerifyClick()">Verify Email Address</button></div>
</div>
<form ng-show="vm.isEmailVerificationRequest">
<div class="usa-alert usa-alert-error" role="alert" ng-show="vm.emailVerificationError">
<div class="usa-alert-body">
<h3 class="usa-alert-heading">Error</h3>
<p class="usa-alert-text">An error occurred while verifying email address. Please try again later if the error persists.</p>
</div>
</div>

{{accountCreated}}
<div class="usa-alert usa-alert-success" role="alert" ng-show="vm.emailVerified">
<div class="usa-alert-body">
<h3 class="usa-alert-heading">Email Verified</h3>
<p class="usa-alert-text">Your email has been verified, you can now Login</a>.</p>
</div>
</div>
</form>

0 comments on commit b6acd71

Please sign in to comment.