Skip to content
This repository has been archived by the owner on Oct 8, 2019. It is now read-only.

Commit

Permalink
feat(Routes): show modal after verifying email
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjors committed Dec 18, 2015
1 parent ecc6c2a commit 9e7438c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 18 deletions.
11 changes: 0 additions & 11 deletions assets/js/controllers/login.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,6 @@ function LoginCtrl($scope, $rootScope, $log, $http, Wallet, Alerts, $cookieStore
if ($scope.key != null) {
$scope.status.enterkey = true;
}
if ($cookieStore.get('email-verified')) {
$cookieStore.remove('email-verified');
$translate(['SUCCESS', 'EMAIL_VERIFIED_SUCCESS', 'EMAIL_VERIFIED_SUCCESS_NO_UID']).then(translations => {
$scope.$emit('showNotification', {
type: 'verified-email',
icon: 'ti-email',
heading: translations.SUCCESS
// msg: $scope.uidAvailable ? translations.EMAIL_VERIFIED_SUCCESS : translations.EMAIL_VERIFIED_SUCCESS_NO_UID
});
});
}
$scope.twoFactorCode = "";
$scope.busy = false;
$scope.isValid = false;
Expand Down
32 changes: 29 additions & 3 deletions assets/js/controllers/verifyEmail.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,40 @@ angular
.module('walletApp')
.controller("VerifyEmailCtrl", VerifyEmailCtrl);

function VerifyEmailCtrl($scope, Wallet, $stateParams, $state, Alerts) {
function VerifyEmailCtrl($scope, Wallet, $stateParams, $state, Alerts, $translate, $rootScope) {
const success = (uid) => {
$state.go("public.login-uid", {uid: uid})
uid = null;

if(uid) {
$translate(['SUCCESS', 'EMAIL_VERIFIED_SUCCESS']).then(translations => {
$state.go("public.login-uid", {uid: uid}).then(() =>{
$rootScope.$emit('showNotification', {
type: 'verified-email',
icon: 'ti-email',
heading: translations.SUCCESS,
msg: translations.EMAIL_VERIFIED_SUCCESS
});
});
});
} else {
$translate(['SUCCESS', 'EMAIL_VERIFIED_SUCCESS_NO_UID']).then(translations => {
$state.go("public.login-no-uid").then(() => {
$rootScope.$emit('showNotification', {
type: 'verified-email',
icon: 'ti-email',
heading: translations.SUCCESS,
msg: translations.EMAIL_VERIFIED_SUCCESS_NO_UID
});
});
});
}


}

const error = (message) => {
$state.go("public.login-no-uid");
Alerts.displayError(error);
Alerts.displayError(message, true);
}

Wallet.verifyEmail($stateParams.token, success, error)
Expand Down
7 changes: 3 additions & 4 deletions assets/js/services/wallet.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -1205,15 +1205,14 @@ function Wallet($http, $window, $timeout, Alerts, MyWallet, MyBlockchainApi, MyB
};

wallet.verifyEmail = (token, successCallback, errorCallback) => {
const success = (result) => {
// TODO: process result in My-Wallet-V3

const success = (guid) => {
wallet.user.isEmailVerified = true;
successCallback(result.guid);
successCallback(guid);
wallet.applyIfNeeded();
}

const error = (message) => {
console.log(message);
errorCallback(message);
}

Expand Down

0 comments on commit 9e7438c

Please sign in to comment.