Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drip
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
backup
Drip
Commits
80f08c06
Commit
80f08c06
authored
6 years ago
by
Julia Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Don't rely on local storage knowing about encryption state
parent
49b1110d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/password-prompt.js
+14
-10
14 additions, 10 deletions
components/password-prompt.js
with
14 additions
and
10 deletions
components/password-prompt.js
+
14
−
10
View file @
80f08c06
import
React
,
{
Component
}
from
'
react
'
import
React
,
{
Component
}
from
'
react
'
import
{
View
,
TextInput
,
TouchableOpacity
,
Alert
,
Image
}
from
'
react-native
'
import
{
View
,
TextInput
,
TouchableOpacity
,
Alert
,
Image
}
from
'
react-native
'
import
nodejs
from
'
nodejs-mobile-react-native
'
import
nodejs
from
'
nodejs-mobile-react-native
'
import
{
saveEncryptionFlag
}
from
'
../local-storage
'
import
{
AppText
}
from
'
./app-text
'
import
{
AppText
}
from
'
./app-text
'
import
{
hasEncryptionObservable
}
from
'
../local-storage
'
import
styles
from
'
../styles
'
import
styles
from
'
../styles
'
import
{
passwordPrompt
as
labels
,
shared
}
from
'
./labels
'
import
{
passwordPrompt
as
labels
,
shared
}
from
'
./labels
'
import
{
requestHash
,
deleteDbAndOpenNew
,
openDb
}
from
'
../db
'
import
{
requestHash
,
deleteDbAndOpenNew
,
openDb
}
from
'
../db
'
...
@@ -13,21 +13,25 @@ export default class PasswordPrompt extends Component {
...
@@ -13,21 +13,25 @@ export default class PasswordPrompt extends Component {
this
.
state
=
{
this
.
state
=
{
password
:
null
password
:
null
}
}
hasEncryptionObservable
.
once
(
async
hasEncryption
=>
{
hasEncryption
=
JSON
.
parse
(
hasEncryption
)
if
(
hasEncryption
)
{
this
.
setState
({
showPasswordPrompt
:
true
})
}
else
{
await
openDb
({
persistConnection
:
true
})
this
.
props
.
showApp
()
}
})
nodejs
.
channel
.
addListener
(
nodejs
.
channel
.
addListener
(
'
message
'
,
'
message
'
,
this
.
passHashToDb
,
this
.
passHashToDb
,
this
this
)
)
this
.
tryToOpenDb
()
}
async
tryToOpenDb
()
{
try
{
await
openDb
({
persistConnection
:
true
})
await
saveEncryptionFlag
(
false
)
}
catch
(
err
)
{
this
.
setState
({
showPasswordPrompt
:
true
})
await
saveEncryptionFlag
(
true
)
return
}
}
}
passHashToDb
=
async
msg
=>
{
passHashToDb
=
async
msg
=>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment