verify email
This commit is contained in:
parent
5d81ed6a96
commit
b24f892f60
|
@ -42,8 +42,4 @@ angular
|
|||
$scope.loading = false;
|
||||
}
|
||||
});
|
||||
|
||||
$scope.submit = function (model) {
|
||||
|
||||
};
|
||||
});
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
angular
|
||||
.module('bit.accounts')
|
||||
|
||||
.controller('accountsVerifyEmailController', function ($scope, $state, apiService, toastr, $analytics) {
|
||||
if (!$state.params.userId || !$state.params.token) {
|
||||
$state.go('frontend.login.info').then(function () {
|
||||
toastr.error('Invalid parameters.');
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.$on('$viewContentLoaded', function () {
|
||||
apiService.accounts.verifyEmailToken({},
|
||||
{
|
||||
token: $state.params.token,
|
||||
userId: $state.params.userId
|
||||
}, function () {
|
||||
$analytics.eventTrack('Verified Email');
|
||||
$state.go('frontend.login.info', null, { location: 'replace' }).then(function () {
|
||||
toastr.success('Your email has been verified. Thank you.', 'Success');
|
||||
});
|
||||
}, function () {
|
||||
$state.go('frontend.login.info', null, { location: 'replace' }).then(function () {
|
||||
toastr.error('Unable to verify email.', 'Error');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,8 @@
|
|||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<i class="fa fa-shield"></i> <b>bit</b>warden
|
||||
</div>
|
||||
<div class="login-box-body">
|
||||
Verifying email...
|
||||
</div>
|
||||
</div>
|
|
@ -7,7 +7,7 @@ angular
|
|||
$locationProvider.hashPrefix('');
|
||||
jwtOptionsProvider.config({
|
||||
urlParam: 'access_token3',
|
||||
whiteListedDomains: ['api.bitwarden.com', 'preview-api.bitwarden.com', 'localhost', '192.168.1.6']
|
||||
whiteListedDomains: ['api.bitwarden.com', 'preview-api.bitwarden.com', 'localhost', '192.168.1.4']
|
||||
});
|
||||
var refreshPromise;
|
||||
jwtInterceptorProvider.tokenGetter = /*@ngInject*/ function (options, tokenService, authService) {
|
||||
|
@ -260,6 +260,16 @@ angular
|
|||
bodyClass: 'login-page',
|
||||
skipAuthorize: true
|
||||
}
|
||||
})
|
||||
.state('frontend.verifyEmail', {
|
||||
url: '^/verify-email?userId&token',
|
||||
templateUrl: 'app/accounts/views/accountsVerifyEmail.html',
|
||||
controller: 'accountsVerifyEmailController',
|
||||
data: {
|
||||
pageTitle: 'Verifying Email',
|
||||
bodyClass: 'login-page',
|
||||
skipAuthorize: true
|
||||
}
|
||||
});
|
||||
})
|
||||
.run(function ($rootScope, authService, $state) {
|
||||
|
|
|
@ -2,7 +2,7 @@ angular
|
|||
.module('bit.global')
|
||||
|
||||
.controller('mainController', function ($scope, $state, authService, appSettings, toastr, $window, $document,
|
||||
cryptoService, $uibModal) {
|
||||
cryptoService, $uibModal, apiService) {
|
||||
var vm = this;
|
||||
vm.bodyClass = '';
|
||||
vm.usingControlSidebar = vm.openControlSidebar = false;
|
||||
|
@ -79,7 +79,19 @@ angular
|
|||
};
|
||||
|
||||
$scope.verifyEmail = function () {
|
||||
// TODO: send email api
|
||||
if ($scope.sendingVerify) {
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.sendingVerify = true;
|
||||
apiService.accounts.verifyEmail({}, null).$promise.then(function () {
|
||||
toastr.success('Verification email sent.');
|
||||
$scope.sendingVerify = false;
|
||||
$scope.verifyEmailSent = true;
|
||||
}).catch(function () {
|
||||
toastr.success('Verification email failed.');
|
||||
$scope.sendingVerify = false;
|
||||
});
|
||||
};
|
||||
|
||||
// Append dropdown menu somewhere else
|
||||
|
|
|
@ -104,6 +104,8 @@
|
|||
register: { url: _apiUri + '/accounts/register', method: 'POST', params: {} },
|
||||
emailToken: { url: _apiUri + '/accounts/email-token', method: 'POST', params: {} },
|
||||
email: { url: _apiUri + '/accounts/email', method: 'POST', params: {} },
|
||||
verifyEmailToken: { url: _apiUri + '/accounts/verify-email-token', method: 'POST', params: {} },
|
||||
verifyEmail: { url: _apiUri + '/accounts/verify-email', method: 'POST', params: {} },
|
||||
putPassword: { url: _apiUri + '/accounts/password', method: 'POST', params: {} },
|
||||
getProfile: { url: _apiUri + '/accounts/profile', method: 'GET', params: {} },
|
||||
putProfile: { url: _apiUri + '/accounts/profile', method: 'POST', params: {} },
|
||||
|
|
|
@ -144,8 +144,16 @@
|
|||
<div class="alert alert-warning alert-notification" ng-click="verifyEmail()"
|
||||
ng-if="main.usingEncKey && main.userProfile && !main.userProfile.emailVerified">
|
||||
<h4><i class="fa fa-envelope fa-fw"></i> Verify Your Email</h4>
|
||||
<div ng-if="!verifyEmailSent">
|
||||
Verify your account's email address to unlock access to all features.
|
||||
<a href="#" stop-click>Send verification email now</a>.
|
||||
<i class="fa fa-spin fa-refresh" ng-if="sendingVerify"></i>
|
||||
</div>
|
||||
<div ng-if="verifyEmailSent">
|
||||
Check your email inbox for a verification link.
|
||||
<a href="#" stop-click>Send verification email again</a>.
|
||||
<i class="fa fa-spin fa-refresh" ng-if="sendingVerify"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div ui-view></div>
|
||||
</div>
|
||||
|
|
|
@ -152,6 +152,7 @@
|
|||
<script src="app/accounts/accountsRecoverController.js"></script>
|
||||
<script src="app/accounts/accountsOrganizationAcceptController.js"></script>
|
||||
<script src="app/accounts/accountsTwoFactorMethodsController.js"></script>
|
||||
<script src="app/accounts/accountsVerifyEmailController.js"></script>
|
||||
|
||||
<script src="app/vault/vaultModule.js"></script>
|
||||
<script src="app/vault/vaultController.js"></script>
|
||||
|
|
Loading…
Reference in New Issue