Skip to content

Commit

Permalink
Hotfix: Merge pull request #262 from fabnavi/tkd-fix-Signing
Browse files Browse the repository at this point in the history
Sign In / Outの挙動修正
tkdsym2 authored Nov 8, 2018
2 parents 8bdea27 + 159c163 commit f0d4be1
Showing 4 changed files with 35 additions and 17 deletions.
2 changes: 2 additions & 0 deletions src/main/index.js
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@ const isDev = require('electron-is-dev');
const log = require('electron-log');
const{ download } = require('electron-dl');

app.commandLine.appendSwitch('remote-debugging-port', 9223);

autoUpdater.logger = log;
autoUpdater.logger.transports.file.level = 'info';
log.info('App starting...');
9 changes: 9 additions & 0 deletions src/renderer/components/MenuIcon.js
Original file line number Diff line number Diff line change
@@ -63,6 +63,15 @@ export const MenuIcon = props => {
.then(res => {
debug('response is: ', res);
props.signedOut();
const authWindow = new remote.BrowserWindow({
modal: true,
width: 400,
height: 800,
webPreferences: {
webSecurity: false
}
});
authWindow.loadURL('http://github.com/logout');
})
.catch(err => debug('error is occuered: ', err));
}
6 changes: 2 additions & 4 deletions src/renderer/components/Navigation/CenterNav.js
Original file line number Diff line number Diff line change
@@ -20,15 +20,13 @@ const CenterNav = props => (
CenterNav.propTypes = {
isLoggedIn: PropTypes.bool,
isAdmin: PropTypes.bool,
isDeveloper: PropTypes.bool,
Uid: PropTypes.string
isDeveloper: PropTypes.bool
};

const mapStateToProps = state => ({
isLoggedIn: state.user.isLoggedIn,
isAdmin: state.user.isAdmin,
isDeveloper: state.user.isDeveloper,
Uid: state.user.credential.Uid
isDeveloper: state.user.isDeveloper
});

export default connect(mapStateToProps)(CenterNav);
35 changes: 22 additions & 13 deletions src/renderer/components/Navigation/Rightnav.js
Original file line number Diff line number Diff line change
@@ -9,18 +9,23 @@ import { RightFrame } from '../../stylesheets/application/share/Frames';

const debug = Debug('fabnavi:js:RightNav');

const RightNav = props => (
<div>
{props.isLoggedIn ? (
<RightFrame>
<MenuIcon act="sign_out" src={`${assetsPath}/images/sign-out.png`} />
<MenuIcon to="/myprojects" src={`https://avatars2.githubusercontent.com/u/${Number(props.Uid)}?v=4`} />
</RightFrame>
) : (
<MenuIcon act="sign_in" src={`${assetsPath}/images/sign-in.png`} />
)}
</div>
);
const RightNav = props => {
return (
<div>
{props.isLoggedIn ? (
<RightFrame>
<MenuIcon act="sign_out" src={`${assetsPath}/images/sign-out.png`} />
<MenuIcon
to="/myprojects"
src={`https://avatars2.githubusercontent.com/u/${Number(props.Uid)}?v=4`}
/>
</RightFrame>
) : (
<MenuIcon act="sign_in" src={`${assetsPath}/images/sign-in.png`} />
)}
</div>
);
};

RightNav.propTypes = {
isLoggedIn: PropTypes.bool,
@@ -29,11 +34,15 @@ RightNav.propTypes = {
Uid: PropTypes.string
};

const checkCredential = _credential => {
return _credential ? _credential : { Uid: 0 };
};

const mapStateToProps = state => ({
isLoggedIn: state.user.isLoggedIn,
isAdmin: state.user.isAdmin,
isDeveloper: state.user.isDeveloper,
Uid: state.user.credential.Uid
Uid: checkCredential(state.user.credential).Uid
});

export default connect(mapStateToProps)(RightNav);

0 comments on commit f0d4be1

Please sign in to comment.