Adding Toggle Email

EMail toggling added to the pool authed zones

Fixes #41
master
Alexander Blair 7 years ago
parent 2a782cb3e8
commit 519f472666

@ -26,4 +26,10 @@ ALTER TABLE pool.shapeshiftTxn CONVERT TO CHARACTER SET utf8 COLLATE utf8_genera
ALTER TABLE pool.transactions CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE pool.users CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE pool.xmrtoTxn CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
```
2/25/2017
---------
```sql
ALTER TABLE monero_live.users ADD enable_email BOOL DEFAULT true NULL;
```

@ -486,8 +486,8 @@ secureRoutes.get('/tokenRefresh', function (req, res) {
});
secureRoutes.get('/', function (req, res) {
global.mysql.query("SELECT payout_threshold FROM users WHERE id = ?", [req.decoded.id]).then(function(row){
return res.json({msg: row[0].payout_threshold});
global.mysql.query("SELECT payout_threshold, enable_email FROM users WHERE id = ?", [req.decoded.id]).then(function(row){
return res.json({msg: {payout_threshold: row[0].payout_threshold, email_enabled: row[0].enable_email}});
});
});
@ -498,6 +498,12 @@ secureRoutes.post('/changePassword', function (req, res) {
});
});
secureRoutes.post('/toggleEmail', function (req, res) {
global.mysql.query("UPDATE users SET enable_email = NOT enable_email WHERE id = ?", [hmac, req.decoded.id]).then(function () {
return res.json({'msg': 'Email toggled'});
});
});
secureRoutes.post('/changePayoutThreshold', function (req, res) {
let threshold = req.body.threshold;
if (threshold < global.config.payout.walletMin) {

@ -210,7 +210,7 @@ function updateShareStats() {
let address_parts = miner.split('_');
let address = address_parts[0];
let worker = address_parts[1];
global.mysql.query("SELECT email FROM users WHERE username = ? limit 1", [address]).then(function (rows) {
global.mysql.query("SELECT email FROM users WHERE username = ? AND enable_email IS true limit 1", [address]).then(function (rows) {
if (rows.length === 0) {
return;
}

Loading…
Cancel
Save