new form for emails

This commit is contained in:
Matias Alejo Garcia 2015-05-14 17:21:45 -03:00
commit bf59f0c94f
2 changed files with 67 additions and 0 deletions

View file

@ -0,0 +1,39 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Email Notifications'; goBackToState = 'preferences'">
</div>
<div class="content preferences p20v" ng-controller="preferencesEmailController as prefEmail">
<div class="onGoingProcess" ng-show="prefEmail.saving && !index.isOffline">
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
<div class="spinner">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div>
<span translate> Saving preferences... </span>
</div>
</div>
<form name="emailForm" ng-submit="prefEmail.save(emailForm)" class="columns" novalidate>
<div class="box-notification" ng-show="prefEmail.error">
<span class="text-warning size-14">
{{prefEmail.error|translate}}
</span>
</div>
<label>email for wallet notifications:</i></label>
<input type="email" id="email" name="email" ng-model="prefEmail.email" required>
<input type="submit" class="button expand black radius" value="{{'Save'|translate}}"
ng-style="{'background-color':index.backgroundColor}" ng-disabled="emailForm.$invalid">
</form>
<p class="text-gray text-center columns size-14" translate> Setting up email notifications could weaken your privacy, if the wallet service provider is compromised. Information available to an attacker would include be the positive confirmation of a bitcoin wallet and its balance, but no more.
</div>
<div class="extra-margin-bottom"></div>

View file

@ -0,0 +1,28 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesEmailController',
function($scope, go, profileService ,gettext, $log) {
this.save = function(form) {
this.error=null;
if (!form.$valid) {
this.error = gettext('Invalid email');
return;
}
console.log('[preferencesEmail.js.12]', this.email); //TODO
var fc = profileService.focusedClient;
this.saving =true;
fc.savePreferences({email:this.email}, function(err) {
fc.saving =false;
if (err) {
$log.warn(err);
$scope.$emit('Local/ClientError', err);
return;
}
go.walletHome();
});
};
});