Merge branch 'develop' of https://github.com/dternyak/zcash-grant-system into require-email-verification

This commit is contained in:
Daniel Ternyak 2019-01-28 15:48:29 -06:00
commit f9237c8544
No known key found for this signature in database
GPG Key ID: DF212D2DC5D0E245
8 changed files with 27 additions and 19 deletions

View File

@ -27,3 +27,7 @@ BLOCKCHAIN_API_SECRET="ef0b48e41f78d3ae85b1379b386f1bca"
# run `flask gen-admin-auth` to create new password for admin
ADMIN_PASS_HASH=18f97883b93a975deb9e29257a341a447302040da59cdc2d10ff65a5e57cc197
# Blockchain explorer to link to. Top for mainnet, bottom for testnet.
# EXPLORER_URL="https://explorer.zcha.in/"
EXPLORER_URL="https://testnet.zcha.in/"

View File

@ -9,6 +9,7 @@ from grant.utils.auth import requires_auth, requires_team_member_auth, get_authe
from grant.utils.exceptions import ValidationException
from grant.utils.misc import is_email, make_url, from_zat, make_preview
from sqlalchemy import or_
from grant.settings import EXPLORER_URL
from .models import (
Proposal,
@ -455,7 +456,7 @@ def post_contribution_confirmation(contribution_id, to, amount, txid):
send_email(contribution.user.email_address, 'contribution_confirmed', {
'contribution': contribution,
'proposal': contribution.proposal,
'tx_explorer_url': f'https://explorer.zcha.in/transactions/{txid}',
'tx_explorer_url': f'{EXPLORER_URL}transactions/{txid}',
})
# Send to the full proposal gang

View File

@ -52,6 +52,8 @@ BLOCKCHAIN_API_SECRET = env.str("BLOCKCHAIN_API_SECRET")
ADMIN_PASS_HASH = env.str("ADMIN_PASS_HASH")
EXPLORER_URL = env.str("EXPLORER_URL", default="https://explorer.zcha.in/")
UI = {
'NAME': 'ZF Grants',
'PRIMARY': '#CF8A00',

View File

@ -269,8 +269,9 @@ class UserSchema(ma.Schema):
return obj.id
user_schema = SelfUserSchema()
users_schema = SelfUserSchema(many=True)
user_schema = UserSchema()
users_schema = UserSchema(many=True)
class SocialMediaSchema(ma.Schema):
class Meta:

View File

@ -63,7 +63,6 @@ class TestUserAPI(BaseUserConfig):
}),
content_type="application/json"
)
print(user_auth_resp.headers)
self.assertEqual(user_auth_resp.json['emailAddress'], self.user.email_address)
self.assertEqual(user_auth_resp.json['displayName'], self.user.display_name)
@ -76,20 +75,24 @@ class TestUserAPI(BaseUserConfig):
}),
content_type="application/json"
)
print(login_resp.headers)
# should have session cookie now
me_resp = self.app.get(
"/api/v1/users/me"
)
print(me_resp.headers)
self.assert200(me_resp)
def test_me_get_includes_email_address(self):
self.login_default_user()
me_resp = self.app.get(
"/api/v1/users/me"
)
self.assert200(me_resp)
self.assertIsNotNone(me_resp.json['emailAddress'])
def test_user_auth_required_fail(self):
me_resp = self.app.get(
"/api/v1/users/me",
)
print(me_resp.json)
print(me_resp.headers)
self.assert401(me_resp)
def test_user_auth_bad_password(self):

View File

@ -11,3 +11,7 @@ BACKEND_URL=http://localhost:5000
# sentry
# SENTRY_DSN=https://PUBLICKEY@sentry.io/PROJECTID
# SENTRY_RELEASE="optional, provides sentry logging with release info"
# Blockchain explorer to link to. Top for mainnet, bottom for testnet.
# EXPLORER_URL="https://explorer.zcha.in/"
EXPLORER_URL="https://testnet.zcha.in/"

View File

@ -87,5 +87,5 @@ export function formatZcashCLI(address: string, amount?: string | number, memo?:
}
export function formatTxExplorerUrl(txid: string) {
return `https://explorer.zcha.in/transactions/${txid}`;
return `${process.env.EXPLORER_URL}transactions/${txid}`;
}

View File

@ -41,14 +41,6 @@ envProductionRequiredHandler(
'http://localhost:' + (process.env.PORT || 3000),
);
if (!process.env.SENTRY_RELEASE) {
process.env.SENTRY_RELEASE = undefined;
}
if (!process.env.BACKEND_URL) {
process.env.BACKEND_URL = 'http://localhost:5000';
}
const appDirectory = fs.realpathSync(process.cwd());
process.env.NODE_PATH = (process.env.NODE_PATH || '')
.split(path.delimiter)
@ -58,12 +50,13 @@ process.env.NODE_PATH = (process.env.NODE_PATH || '')
module.exports = () => {
const raw = {
BACKEND_URL: process.env.BACKEND_URL,
BACKEND_URL: process.env.BACKEND_URL || 'http://localhost:5000',
EXPLORER_URL: process.env.EXPLORER_URL || 'https://chain.so/zcash/',
NODE_ENV: process.env.NODE_ENV || 'development',
PORT: process.env.PORT || 3000,
PUBLIC_HOST_URL: process.env.PUBLIC_HOST_URL,
SENTRY_DSN: process.env.SENTRY_DSN || null,
SENTRY_RELEASE: process.env.SENTRY_RELEASE,
SENTRY_RELEASE: process.env.SENTRY_RELEASE || undefined,
};
// Stringify all values so we can feed into Webpack DefinePlugin