Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hash Password #4

Merged
merged 6 commits into from Dec 6, 2018
Merged

Hash Password #4

merged 6 commits into from Dec 6, 2018

Conversation

darekmydlarz
Copy link
Contributor

@darekmydlarz darekmydlarz commented Dec 6, 2018

Hash password in the library, before sending POST request.

Fixes:

const [url, params] = mockImplementation.mock.calls[0]
const reqBody = JSON.parse(params.body)

expect(url).to.eq('backurl/api/v1/user/register')
expect(params.method).to.eq('POST')
expect(reqBody.email).to.eq('a')
expect(reqBody.password).to.eq('b')
expect(reqBody.password).to.eq(hashedPassword)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja bym zinlinowal te zmienna hashedPassword. I wydzielil zmienna password wiec mialbym

const password = 'b'
await api.register('a', password)

const [url, params] = mockImplementation.mock.calls[0]
const reqBody = JSON.parse(params.body)

expect(url).to.eq('backurl/api/v1/user/register')
expect(params.method).to.eq('POST')
expect(reqBody.email).to.eq('a')
expect(reqBody.password).to.eq(hashPassword(password))

@@ -2,6 +2,7 @@ import { expect } from 'chai'

import * as api from '../backend-api'
import * as request from '../utils/request'
import { hashPassword } from '../crypto';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unused import

@darekmydlarz darekmydlarz merged commit 6a3c1b7 into master Dec 6, 2018
@darekmydlarz darekmydlarz deleted the hash-password branch December 6, 2018 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants