Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
condenser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository 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
hive
condenser
Commits
6cd97da3
Commit
6cd97da3
authored
8 years ago
by
Valentine Zavgorodnev
Committed by
valzav
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Warn if password does not match checksum. #479 (#503)
parent
4c280845
Branches
phone
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/components/elements/Template.jsx
+1
-0
1 addition, 0 deletions
app/components/elements/Template.jsx
app/components/modules/LoginForm.jsx
+16
-1
16 additions, 1 deletion
app/components/modules/LoginForm.jsx
with
17 additions
and
1 deletion
app/components/elements/Template.jsx
+
1
−
0
View file @
6cd97da3
...
...
@@ -31,6 +31,7 @@ class Template extends React.Component {
// }
// componentWillUpdate(nextProps, nextState) {
// // Can't call this.setState() here, use componentWillReceiveProps instead
// }
// componentDidUpdate(prevProps, prevState) {
...
...
This diff is collapsed.
Click to expand it.
app/components/modules/LoginForm.jsx
+
16
−
1
View file @
6cd97da3
/* eslint react/prop-types: 0 */
import
React
,
{
PropTypes
,
Component
}
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
{
PublicKey
}
from
'
shared/ecc
'
import
{
PublicKey
,
PrivateKey
}
from
'
shared/ecc
'
import
transaction
from
'
app/redux/Transaction
'
import
g
from
'
app/redux/GlobalReducer
'
import
user
from
'
app/redux/User
'
...
...
@@ -155,6 +155,11 @@ class LoginForm extends Component {
</
div
>;
}
}
const
standardPassword
=
checkPasswordChecksum
(
password
.
value
)
const
password_info
=
standardPassword
===
undefined
?
null
:
standardPassword
?
'
Password checks out and appears valid.
'
:
'
This password was probably typed or copied incorrectly.
'
const
form
=
(
<
form
onSubmit
=
{
handleSubmit
(
data
=>
{
// bind redux-form to react-redux
...
...
@@ -173,6 +178,7 @@ class LoginForm extends Component {
<
div
>
<
input
type
=
"password"
required
ref
=
"pw"
placeholder
=
"Password or WIF"
{
...
password
.
props
}
autoComplete
=
"on"
disabled
=
{
submitting
}
/>
<
div
className
=
"error"
>
{
error
}
</
div
>
{
password_info
&&
<
div
className
=
"warning"
>
{
password_info
}
</
div
>
}
</
div
>
{
loginBroadcastOperation
&&
<
div
>
<
div
className
=
"info"
>
This operation requires your
{
authType
}
key (or use your master password).
</
div
>
...
...
@@ -219,6 +225,15 @@ function urlAccountName() {
return
suggestedAccountName
}
function
checkPasswordChecksum
(
password
)
{
if
(
!
/^P.
{45,}
/
.
test
(
password
))
{
// 52 is the length
// not even close
return
undefined
}
const
wif
=
password
.
substring
(
1
)
return
PrivateKey
.
isWif
(
wif
)
}
import
{
connect
}
from
'
react-redux
'
export
default
connect
(
...
...
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