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

Sign Up View #186

Merged
merged 2 commits into from
Feb 20, 2017
Merged

Sign Up View #186

merged 2 commits into from
Feb 20, 2017

Conversation

vijayee
Copy link
Contributor

@vijayee vijayee commented Feb 17, 2017

No description provided.

login: async function () {
try {
let response = await namespace.lookup(this.name)
let identity = JSON.parse(response.text)
Copy link
Member

Choose a reason for hiding this comment

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

This is already parsed for you in response.body, so no need to re-parse.

]
})
await namespace.register(this.name, user.toHash())
await db.storeLogin(user.toHash(), multihash.toB58String(multihash.encode(new Buffer(this.password), 'blake2b')))
Copy link
Member

Choose a reason for hiding this comment

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

OK, for now can you just directly store the password + add a TODO comment? That way I can hook in the crypto stuff later when it's ready, as simply storing the hash isn't secure (and this is also not how one would do it, i.e. it's missing the actual black2 stuff).

forwardToLogin: function () {
Vue.events.$emit('login')
},
checkName: async function () {
Copy link
Member

Choose a reason for hiding this comment

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

Let's have this called via a debounced manner each time the field changes. I.e. no more than calling it once per 2 seconds. If you search the vuejs guide for "debounce" you'll get several results, including this one:

Notice also the note at the bottom regarding throttle. Decide which provides a better experience and go for it. For importing debounce or throttle, see how it's done in state.js for debouncedSave.

if (this.$route.query.next) {
setTimeout(() => {
this.$router.push({path: this.$route.query.next})
}, 1000)
Copy link
Member

@taoeffect taoeffect Feb 18, 2017

Choose a reason for hiding this comment

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

Why is this delayed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So that you can see the success message before transitioning

test/frontend.js Outdated
let randInt = (min, max) => Math.floor(Math.random() * (max - min)) + min
let username = `testuser${randInt(0, 10000000)}${randInt(10000000, 20000000)}`
it('Should register User', async function () {
this.timeout(10000)
Copy link
Member

@taoeffect taoeffect Feb 18, 2017

Choose a reason for hiding this comment

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

Tests should never need such a large timeout, I would set this to 4000, max. If a test takes longer it's usually an indication of a really special circumstance or something wrong. Same for the timeouts below.

/* There appears to be a bug in nightmare that causes the insert and type commands to enter old data into the field if the
insert or type commands or used more than once on the same field. This concatenates the old values to the new.
This occurs regardless of whether you clear the field or not. Until its fixed skip this validation test
*/
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, did you try the Nightmare docs suggestion of inserting empty values to clear the field?

Both the .type and the .insert commands say they support it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this happens regardless of whether you clear the fields per their instructions.

test/frontend.js Outdated
await n.goto(page('signup'))
let badUsername = 't e s t'
let badEmail = `@fail`
// let badPassword = `789`// six is so afraid
Copy link
Member

Choose a reason for hiding this comment

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

Great job on making sure to test our error conditions! This greatly helps our coverage.

}
export function retrieveLogin (identity: string): Promise<Object> {
return loginInfo.getItem(identity)
}
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to do this as part of the settings? The 'testUser' above there was meant to be a reminder to use that for all user-specific settings.

}
},
forwardToLogin: function () {
Vue.events.$emit('login')
Copy link
Member

Choose a reason for hiding this comment

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

Can you make it so that the username field is highlighted and ready to be typed in when the login thing is brought up?

@@ -16,23 +16,27 @@
<div class="box centered" style="max-width:400px">
<h2 class="subtitle">Sign Up</h2>

<a v-on:click="forwardToLogin" style="margin-left: 65%">Already a member?</a>
Copy link
Member

Choose a reason for hiding this comment

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

Can you change this to, "Have an account?"

}
},
logout: function () {
this.$store.commit('logout')
Copy link
Member

Choose a reason for hiding this comment

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

Clicking logout should take us to the home view (/simple/).

this.password = null
this.errors.clear()
// https://github.com/oneuijs/You-Dont-Need-jQuery#css--style
this.$refs.modal.classList.toggle('is-active')
Copy link
Member

@taoeffect taoeffect Feb 19, 2017

Choose a reason for hiding this comment

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

So the login modal should disappear if we click anywhere on the background or hit the 'esc' key.

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.

2 participants