Merge branch 'master' into issue/763

This commit is contained in:
Igor Gassmann 2017-12-26 10:25:26 -03:00
commit 47bdc6cbef
9 changed files with 77 additions and 22 deletions

View file

@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.19.1
current_version = 0.19.2
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((?P<release>[a-z]+)(?P<candidate>\d+))?

View file

@ -8,7 +8,7 @@ Web UI version numbers should always match the corresponding version of LBRY App
## [Unreleased]
### Added
* Added copy address button to the Wallet Address component on Send / Receive (#875)
*
*
### Changed
@ -27,6 +27,24 @@ Web UI version numbers should always match the corresponding version of LBRY App
*
*
## [0.19.2] - 2017-12-22
### Added
* Added copy address button to the Wallet Address component on Send / Receive (#875)
* Link to creators channels on homepage (#869)
* Pause playing video when file is opened (#880)
* Add captcha to verification process (#897)
### Changed
* Contributor documentation (#879)
### Fixed
* Linux app categorization (#877)
## [0.19.1] - 2017-12-13
### Added

View file

@ -1,6 +1,6 @@
{
"name": "LBRY",
"version": "0.19.1",
"version": "0.19.2",
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
"homepage": "https://lbry.io/",
"bugs": {

View file

@ -95,7 +95,6 @@ function openItem(fullPath) {
// Causes child process reference to be garbage collected, allowing main process to exit
child.unref();
}
/*
* Quits by first killing the daemon, the calling quitting for real.
*/
@ -167,7 +166,7 @@ function createWindow() {
if (openUri) {
// We stored and received a URI that an external app requested before we had a window object
window.webContents.on('did-finish-load', () => {
window.webContents.send('open-uri-requested', openUri);
window.webContents.send('open-uri-requested', openUri, true);
});
}

View file

@ -1,6 +1,6 @@
import React from 'react';
import { connect } from 'react-redux';
import { doUserEmailVerify } from 'redux/actions/user';
import { doUserEmailVerify, doUserEmailVerifyFailure } from 'redux/actions/user';
import {
selectEmailVerifyIsPending,
selectEmailToVerify,
@ -20,7 +20,8 @@ const select = state => ({
});
const perform = dispatch => ({
verifyUserEmail: code => dispatch(doUserEmailVerify(code)),
verifyUserEmail: (code, recaptcha) => dispatch(doUserEmailVerify(code, recaptcha)),
verifyUserEmailFailure: error => dispatch(doUserEmailVerifyFailure(error)),
});
export default connect(select, perform)(UserEmailVerify);

View file

@ -20,7 +20,12 @@ class UserEmailVerify extends React.PureComponent {
handleSubmit() {
const { code } = this.state;
this.props.verifyUserEmail(code);
try {
const verification = JSON.parse(atob(code));
this.props.verifyUserEmail(verification.token, verification.recaptcha);
} catch (error) {
this.props.verifyUserEmailFailure('Invalid Verification Token');
}
}
render() {

View file

@ -6,7 +6,8 @@ import SnackBar from 'component/snackBar';
import { Provider } from 'react-redux';
import store from 'store';
import SplashScreen from 'component/splash';
import { doDaemonReady } from 'redux/actions/app';
import { doDaemonReady, doShowSnackBar, doConditionalAuthNavigate } from 'redux/actions/app';
import { doUserEmailVerify } from 'redux/actions/user';
import { doNavigate } from 'redux/actions/navigation';
import { doDownloadLanguages } from 'redux/actions/settings';
import * as ACTIONS from 'constants/action_types';
@ -28,10 +29,25 @@ window.addEventListener('contextmenu', event => {
event.preventDefault();
});
ipcRenderer.on('open-uri-requested', (event, uri) => {
ipcRenderer.on('open-uri-requested', (event, uri, newSession) => {
if (uri && uri.startsWith('lbry://')) {
if (uri.startsWith('lbry://?verify=')) {
let verification = {};
try {
verification = JSON.parse(atob(uri.substring(15)));
} catch (error) {
console.log(error);
}
if (verification.token && verification.recaptcha) {
app.store.dispatch(doConditionalAuthNavigate(newSession));
app.store.dispatch(doUserEmailVerify(verification.token, verification.recaptcha));
} else {
app.store.dispatch(doShowSnackBar({ message: 'Invalid Verification URI' }));
}
} else {
app.store.dispatch(doNavigate('/show', { uri }));
}
}
});
ipcRenderer.on('open-menu', (event, uri) => {

View file

@ -15,7 +15,8 @@ import { doAuthenticate } from 'redux/actions/user';
import { doFetchFileInfosAndPublishedClaims } from 'redux/actions/file_info';
import * as MODALS from 'constants/modal_types';
import { doFetchRewardedContent } from 'redux/actions/content';
import { ipcRenderer, remote } from 'electron';
import { doAuthNavigate } from 'redux/actions/navigation';
import { remote, ipcRenderer } from 'electron';
import Path from 'path';
const { download } = remote.require('electron-dl');
@ -261,3 +262,12 @@ export function doChangeVolume(volume) {
});
};
}
export function doConditionalAuthNavigate(newSession) {
return function(dispatch, getState) {
const state = getState();
if (newSession || selectCurrentModal(state) !== 'email_collection') {
dispatch(doAuthNavigate());
}
};
}

View file

@ -116,20 +116,31 @@ export function doUserEmailNew(email) {
};
}
export function doUserEmailVerify(verificationToken) {
export function doUserEmailVerifyFailure(error) {
return {
type: ACTIONS.USER_EMAIL_VERIFY_FAILURE,
data: { error },
};
}
export function doUserEmailVerify(verificationToken, recaptcha) {
return function(dispatch, getState) {
const email = selectEmailToVerify(getState());
const trimmedVerificationToken = verificationToken.toString().trim();
dispatch({
type: ACTIONS.USER_EMAIL_VERIFY_STARTED,
code: trimmedVerificationToken,
code: verificationToken,
recaptcha,
});
Lbryio.call(
'user_email',
'confirm',
{ verification_token: trimmedVerificationToken, email },
{
verification_token: verificationToken,
email,
recaptcha,
},
'post'
)
.then(userEmail => {
@ -144,12 +155,7 @@ export function doUserEmailVerify(verificationToken) {
throw new Error('Your email is still not verified.'); // shouldn't happen
}
})
.catch(error => {
dispatch({
type: ACTIONS.USER_EMAIL_VERIFY_FAILURE,
data: { error },
});
});
.catch(error => dispatch(doUserEmailVerifyFailure(error)));
};
}