cleanup verification constants

This commit is contained in:
Tankred Hase 2013-11-17 13:34:57 +01:00
parent c87995ee48
commit 6ed6ffdc20
2 changed files with 10 additions and 16 deletions

View File

@ -29,7 +29,8 @@ define([], function() {
}
},
checkOutboxInterval: 30000,
iconPath: '/img/icon.png'
iconPath: '/img/icon.png',
verificationUrl: '/verify/'
};
/**
@ -41,16 +42,8 @@ define([], function() {
cryptPrefix: '-----BEGIN PGP MESSAGE-----',
cryptSuffix: '-----END PGP MESSAGE-----',
signature: 'Sent securely from whiteout mail',
webSite: 'http://whiteout.io'
};
/**
* Contants are maintained here.
*/
app.constants = {
verificationSubject: 'New public key uploaded',
verificationUrlPrefix: 'https://keys.whiteout.io/verify/',
verificationUuidLength: 36
webSite: 'http://whiteout.io',
verificationSubject: 'New public key uploaded'
};
return app;

View File

@ -4,7 +4,7 @@ define(function(require) {
var _ = require('underscore'),
util = require('cryptoLib/util'),
str = require('js/app-config').string,
consts = require('js/app-config').constants;
config = require('js/app-config').config;
/**
* A high-level Data-Access Api for handling Email synchronization
@ -269,7 +269,7 @@ define(function(require) {
}
function isVerificationMail(email) {
return email.subject === consts.verificationSubject;
return email.subject === str.verificationSubject;
}
function parseMessageBlock(email) {
@ -307,7 +307,8 @@ define(function(require) {
}
function verify(email, localCallback) {
var uuid, index;
var uuid, index,
verifiyUrlPrefix = config.cloudUrl + config.verificationUrl;
if (!email.unread) {
// don't bother if the email was already marked as read
@ -315,13 +316,13 @@ define(function(require) {
return;
}
index = email.body.indexOf(consts.verificationUrlPrefix);
index = email.body.indexOf(verifiyUrlPrefix);
if (index === -1) {
localCallback();
return;
}
uuid = email.body.substr(index + consts.verificationUrlPrefix.length, consts.verificationUuidLength);
uuid = email.body.split(config.verificationUrl)[1];
self._keychain.verifyPublicKey(uuid, function(err) {
if (err) {
callback({