nsgm-cli 2.0.7 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,9 +15,37 @@ export const GlobalStyle = createGlobalStyle`
15
15
 
16
16
  export const Container = styled.div`
17
17
  margin: 20px;
18
+ `
19
+
20
+ export const LoginContainer = styled.div`
21
+ margin: auto;
22
+ margin-top: 200px;
23
+ width: 250px;
24
+ display: flex;
25
+ flex-direction: column;
26
+ justify-content: center;
27
+ align-items: flex-start;
28
+ border: 1px solid gray;
29
+ border-radius: 5px;
30
+ padding: 20px;
18
31
 
19
- .user-input {
20
- margin-right: 5px;
32
+ .row {
33
+ width: 100%;
34
+ display: flex;
35
+ flex: 1;
36
+ flex-direction: row;
37
+ justify-content: flex-start;
38
+ align-items: center;
39
+
40
+ .user-input {
41
+ width: 210px;
42
+ margin-bottom: 5px;
43
+ }
44
+ }
45
+
46
+ .right {
47
+ margin-top: 10px;
48
+ justify-content: flex-end;
21
49
  }
22
50
  `
23
51
 
@@ -28,4 +56,5 @@ export const Loading = styled.div`
28
56
  justify-content: center;
29
57
  align-items: center;
30
58
  margin-top: 100px;
31
- `
59
+ `
60
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nsgm-cli",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "A CLI tool to run Next/Style-components and Graphql/Mysql fullstack project",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/pages/login.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import MarkdownIt from 'markdown-it'
2
2
  import _ from 'lodash'
3
- import { Container } from '../client/styled/common'
4
- import getConfig from 'next/config'
3
+ import { LoginContainer } from '../client/styled/common'
4
+ // import getConfig from 'next/config'
5
5
  import React, { useState } from 'react'
6
6
  import { handleXSS } from '../client/utils/common'
7
7
 
@@ -11,16 +11,17 @@ const md = new MarkdownIt({
11
11
  typographer: true
12
12
  })
13
13
 
14
- const nextConfig = getConfig()
15
- const { publicRuntimeConfig } = nextConfig
16
- const { env } = publicRuntimeConfig
14
+ // const nextConfig = getConfig()
15
+ // const { publicRuntimeConfig } = nextConfig
16
+ // const { env } = publicRuntimeConfig
17
17
 
18
18
  const renderArr:any = []
19
19
 
20
- renderArr.push('Login' + env)
20
+ renderArr.push('Login')
21
21
 
22
22
  const Page = ({ html }) => {
23
23
  const [userName, setUserName] = useState("")
24
+ const [userPassword, setUserPassword] = useState("")
24
25
 
25
26
  const createMarkup = () => {
26
27
  return {
@@ -32,7 +33,7 @@ const Page = ({ html }) => {
32
33
  if(typeof window !== "undefined"){
33
34
  let locationHref = window.location.origin + "?ticket=XXX"
34
35
  if(userName !== ''){
35
- locationHref += "&name=" + handleXSS(userName)
36
+ locationHref += "&name=" + btoa(handleXSS(userName + "," + userPassword))
36
37
  window.location.href = locationHref
37
38
  }
38
39
  }
@@ -42,12 +43,25 @@ const Page = ({ html }) => {
42
43
  setUserName(_.trim(e.target.value))
43
44
  }
44
45
 
46
+ const doChangePassword = (e)=>{
47
+ setUserPassword(_.trim(e.target.value))
48
+ }
49
+
45
50
  return (
46
- <Container>
51
+ <LoginContainer>
47
52
  <div dangerouslySetInnerHTML={createMarkup()} />
48
- <input type="text" name="user" className='user-input' onChange={doChangeName} value={userName}></input>
49
- <button onClick={doLogin}>login</button>
50
- </Container>
53
+ <input type="text" style={{ opacity:0, position:"absolute", width:0, height:0 }}></input>
54
+ <input type="password" style={{ opacity:0, position:"absolute", width:0, height:0 }}></input>
55
+ <div className='row'>
56
+ <input type="text" name="user-name" className='user-input' autoComplete='off' onChange={doChangeName} value={userName}></input>
57
+ </div>
58
+ <div className='row'>
59
+ <input type="password" name="user-password" className='user-input' autoComplete='off' onChange={doChangePassword} value={userPassword}></input>
60
+ </div>
61
+ <div className='row right'>
62
+ <button onClick={doLogin}>login</button>
63
+ </div>
64
+ </LoginContainer>
51
65
  )
52
66
  }
53
67
 
@@ -19,9 +19,9 @@ router.get('/sessionCheck', (req, res) => {
19
19
  router.get('/ticketCheck', (req, res) => {
20
20
  const { query } = req
21
21
  const { ticket, name } = query
22
- // console.log('name', name)
22
+ // console.log('name', name, atob(name))
23
23
 
24
- if(name === "erishen"){
24
+ if(atob(name) === "erishen,123456"){
25
25
  res.json({
26
26
  name: 'ticketCheck',
27
27
  query,