mirror of
https://github.com/bitwarden/web
synced 2025-12-06 00:03:28 +00:00
29 lines
1.2 KiB
JavaScript
29 lines
1.2 KiB
JavaScript
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');
|
|
});
|
|
});
|
|
});
|
|
});
|