Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
Desktop Client
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SeeBeyond
Desktop Client
Commits
d184e756
Commit
d184e756
authored
Nov 29, 2020
by
Amy Yan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switched to using keytar for token storage
parent
61ec76cf
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
300 additions
and
59 deletions
+300
-59
package-lock.json
package-lock.json
+277
-53
package.json
package.json
+1
-0
src/background.js
src/background.js
+6
-1
src/views/Login.vue
src/views/Login.vue
+14
-4
vue.config.js
vue.config.js
+2
-1
No files found.
package-lock.json
View file @
d184e756
This diff is collapsed.
Click to expand it.
package.json
View file @
d184e756
...
...
@@ -23,6 +23,7 @@
"
axios
"
:
"
^0.19.2
"
,
"
core-js
"
:
"
^3.6.4
"
,
"
glob
"
:
"
^7.1.6
"
,
"
keytar
"
:
"
^7.2.0
"
,
"
md5-file
"
:
"
^5.0.0
"
,
"
moment
"
:
"
^2.27.0
"
,
"
ncp
"
:
"
^2.0.0
"
,
...
...
src/background.js
View file @
d184e756
...
...
@@ -6,6 +6,7 @@ const http = require('http');
const
https
=
require
(
'
https
'
);
const
path
=
require
(
'
path
'
);
const
uniqid
=
require
(
'
uniqid
'
);
const
keytar
=
require
(
'
keytar
'
)
let
win
;
let
deeplinkingData
;
...
...
@@ -211,3 +212,7 @@ function download(url, fileName, cb) {
if
(
cb
)
cb
(
err
.
message
,
dest
);
});
};
ipcMain
.
on
(
"
setToken
"
,
(
event
,
ipcData
)
=>
{
keytar
.
setPassword
(
'
Spinshare
'
,
'
ConnectToken
'
,
ipcData
.
ConnectToken
);
})
src/views/Login.vue
View file @
d184e756
...
...
@@ -27,6 +27,9 @@
import
Loading
from
'
@/components/Loading.vue
'
;
import
{
remote
,
ipcRenderer
}
from
'
electron
'
;
import
keytar
from
'
keytar
'
;
export
default
{
name
:
'
Login
'
,
components
:
{
...
...
@@ -42,14 +45,16 @@
apiLoginServerError
:
false
}
},
mounted
:
function
()
{
mounted
:
async
function
()
{
let
ssapi
=
new
SSAPI
();
let
userSettings
=
new
UserSettings
();
if
(
!
userSettings
.
get
(
"
connectToken
"
))
{
let
token
=
await
keytar
.
findPassword
(
'
Spinshare
'
);
if
(
!
token
)
{
this
.
showLoginBox
();
}
else
{
ssapi
.
validateConnectToken
(
userSettings
.
get
(
"
connectToken
"
)
).
then
((
data
)
=>
{
ssapi
.
validateConnectToken
(
token
).
then
((
data
)
=>
{
if
(
data
)
{
this
.
$router
.
replace
({
name
:
'
StartupFrontpage
'
});
}
else
{
...
...
@@ -79,7 +84,9 @@
switch
(
data
.
status
)
{
case
200
:
// Successfull
userSettings
.
set
(
"
connectToken
"
,
data
.
data
);
ipcRenderer
.
send
(
"
setToken
"
,
{
ConnectToken
:
data
.
data
});
this
.
$router
.
replace
({
name
:
'
StartupFrontpage
'
});
break
;
case
403
:
...
...
@@ -98,6 +105,9 @@
this
.
$data
.
apiLoginLoading
=
false
;
this
.
$data
.
apiLoginCodeError
=
false
;
this
.
$data
.
apiLoginServerError
=
false
;
},
getCredentialFromStore
:
async
function
()
{
return
await
keytar
.
findPassword
(
'
Spinshare
'
);
}
},
watch
:
{
...
...
vue.config.js
View file @
d184e756
...
...
@@ -26,7 +26,8 @@ module.exports = {
dmg
:
{
backgroundColor
:
"
#212629
"
}
}
},
externals
:
[
'
keytar
'
]
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment