Skip to content

Add password confirmation to choose_password #3994

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

Merged

Conversation

pungme
Copy link
Contributor

@pungme pungme commented Jul 4, 2017

@pungme pungme changed the title update choose password html template Add password confirmation to choose_password Jul 4, 2017
@codecov
Copy link

codecov bot commented Jul 4, 2017

Codecov Report

Merging #3994 into master will increase coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3994      +/-   ##
==========================================
+ Coverage    92.2%   92.22%   +0.02%     
==========================================
  Files         116      116              
  Lines        8092     8092              
==========================================
+ Hits         7461     7463       +2     
+ Misses        631      629       -2
Impacted Files Coverage Δ
...dapters/Storage/Postgres/PostgresStorageAdapter.js 96.62% <0%> (+0.11%) ⬆️
src/RestWrite.js 93.34% <0%> (+0.18%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f2fc3ce...91f5670. Read the comment docs.

Copy link
Contributor

@flovilmart flovilmart left a comment

Choose a reason for hiding this comment

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

A few nits here and there, @natanrolnik can you validate the JS logic for me please?



button:disabled,
button[disabled]{
Copy link
Contributor

Choose a reason for hiding this comment

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

nit space button[disabled] {

@@ -126,6 +131,12 @@
word-spacing: 0px;
}

#password_match_info{
Copy link
Contributor

Choose a reason for hiding this comment

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

nit space #password_match_info{ 

@@ -156,12 +176,16 @@
while (pair = tokenize.exec(querystring))
urlParams[re_space(pair[1])] = re_space(pair[2]);
})();

Copy link
Contributor

Choose a reason for hiding this comment

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

remove white spaces :)

var id = urlParams['id'];
var base = PARSE_SERVER_URL;
document.getElementById('form').setAttribute('action', base + '/apps/' + id + '/request_password_reset');
document.getElementById('username').value = urlParams['username'];
document.getElementById('username_label').appendChild(document.createTextNode(urlParams['username']));
document.getElementById("password").oninput = validatePassword;
Copy link
Contributor

Choose a reason for hiding this comment

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

@natanrolnik not sure about that, should we use event listeners instead or is is valid?

function validatePassword(){
var pass2 = document.getElementById("password").value;
var pass1 = document.getElementById("password_confirm").value;
if(pass1 !== pass2){
Copy link
Contributor

Choose a reason for hiding this comment

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

nit spaces if (pass1 !== pass2) {

var pass2 = document.getElementById("password").value;
var pass1 = document.getElementById("password_confirm").value;
if(pass1 !== pass2){
if(document.getElementById("password_confirm").value){
Copy link
Contributor

Choose a reason for hiding this comment

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

same

document.getElementById("change_password").disabled = true;
document.getElementById("password_match_info").innerHTML = "Must match the previous entry"
}
}else{
Copy link
Contributor

Choose a reason for hiding this comment

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

same

document.getElementById("change_password").disabled = false;
document.getElementById("password_match_info").innerHTML = ""
}
//empty string means no validation error
Copy link
Contributor

Choose a reason for hiding this comment

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

nit alignment

@flovilmart
Copy link
Contributor

@pungme nice feature, a few nits here and there but otherwise, I'll be happy to get that in!

@pungme
Copy link
Contributor Author

pungme commented Jul 9, 2017

Hey @flovilmart thanks for the review! I've changed base on your suggestion. Cheers

@flovilmart
Copy link
Contributor

@pungme did you run some tests on that?

@pungme
Copy link
Contributor Author

pungme commented Jul 10, 2017

Hey @flovilmart yes i did ran the test on our dev environment. Or do you mean I should write some test on it?

@pungme
Copy link
Contributor Author

pungme commented Jul 13, 2017

Just tested on our production, it seems to work fine. let us know if there're anything we should change. Thanks!

@montymxb
Copy link
Contributor

@pungme this would be awesome if we can get the coverage up to pass. Can you go back over and add one or two tests to account for anything that's untested?

@pungme
Copy link
Contributor Author

pungme commented Sep 10, 2017

@montymxb sure! Sorry that i didn’t come back to this pr. I think i’ll have time again this week. :-)

@montymxb
Copy link
Contributor

montymxb commented Nov 3, 2017

Whoop time flies! Thanks for getting the coverage up to spec @pungme .

@flovilmart JS logic looks good to me 👍
For your convenience here's what it looks like by default.
screen shot 2017-11-02 at 23 23 00

and here's what it looks like once you start typing in your password again, until it matches the existing entry. Just locks the button and displays the text, undoing it once they're both equivalent.
screen shot 2017-11-02 at 23 23 10

As far as setting an inline event callback, that will work just fine. The issue being you can't add more than one without overriding the existing entry for that event. If we want to add more than one listener per event we'll need something that accounts for IE < 9.

function addEventListener(elm, event, func) {
    if(elm.attachEvent) {
        // old IE
        return elm.attachEvent('on' + event, func);
    } else {
        // everything else
        return elm.addEventListener(event, func, false);
    }
}

// add to some element
addEventListener(document.getElementById('id'), 'input', function() {
    // do something on input...
});

@flovilmart
Copy link
Contributor

Oh that’s amazing!

@flovilmart
Copy link
Contributor

@montymxb you're afraid it won't fly on ie 9? Should we support it?

@montymxb
Copy link
Contributor

montymxb commented Nov 3, 2017

Nope, should be just fine 👍 . It's just adding it like any other attribute of an html element. The only thing being if we ever wanted to go back to this and add another listener on the same event (on the same element) we would have to do the above method or something similar. Considering that I'm willing to give this an approval as is.

@flovilmart flovilmart merged commit 842343a into parse-community:master Nov 3, 2017
UnderratedDev pushed a commit to UnderratedDev/parse-server that referenced this pull request Mar 21, 2020
* update choose_password to have the confirmation

* update commander

* reverted the base

* remove some spaces

* nits

* more nits
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.

3 participants