소스 검색

feat(webui): add logout button to admin dashboard

Mustafa Arici 8 년 전
부모
커밋
ecfbf61d2d
4개의 변경된 파일12개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      bindata/bindata.go
  2. 0 0
      template/bundle.js
  3. 11 1
      webui/ovpm/app/components/Dashboard/AdminDashboard/index.jsx
  4. 0 0
      webui/ovpm/public/bundle.js

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
bindata/bindata.go


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
template/bundle.js


+ 11 - 1
webui/ovpm/app/components/Dashboard/AdminDashboard/index.jsx

@@ -3,6 +3,7 @@ import React from 'react';
 import {GetAuthToken, ClearAuthToken} from '../../../utils/auth.js';
 import {API} from '../../../utils/restClient.js';
 import {baseURL, endpoints} from '../../../api.js';
+import { Redirect } from 'react-router'
 import Panel from 'muicss/lib/react/panel';
 import Button from 'muicss/lib/react/button';
 import Container from 'muicss/lib/react/container';
@@ -68,6 +69,7 @@ export default class AdminDashboard extends React.Component {
         super(props)
 
         this.state = {
+            logout: false,
             users: [],
             networks: [],
             vpn: {},
@@ -404,11 +406,18 @@ export default class AdminDashboard extends React.Component {
         console.log(error)
     }
 
-
+    handleLogout() {
+        ClearAuthToken()
+        this.setState({logout: true})
+    }
 
 
 
     render() {
+        if (this.state.logout) {
+            return <Redirect to="/login" />
+        }
+
         let users = []
         for (var i = 0; i < this.state.users.length; i++) {
             let isStatic = ""
@@ -472,6 +481,7 @@ export default class AdminDashboard extends React.Component {
         return (
             <Container>
                 <Panel>
+                    <Button className="mui--pull-right" color="primary" onClick={this.handleLogout.bind(this)}>Logout</Button>
                     <Container>
                         <Modal isOpen={this.state.modal === CREATINGNEWUSER} contentLabel="Modal" style={modalStyle}>
                             <UserEdit title="Create New User" onCancel={this.handleCloseModal.bind(this)} onSave={this.handleNewUserSave.bind(this)} isUsernameDisabled={false}/>

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
webui/ovpm/public/bundle.js


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.