-
Notifications
You must be signed in to change notification settings - Fork 235
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
Signup Page for Fabrik #502
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sayamkanwar can you please post some other mock ups for signup page, this doesn't match the theme of Fabrik.
Sure @Ram81 |
@Ram81, do you want me to completely change the design or change the color scheme to match with that of Fabrik? |
Or would you like something like this? @Ram81 |
@Ram81, Can you please describe what type of design are you expecting? |
Also @Ram81, can you please review the code as well? So that I can do all the changes at once. |
@sayamkanwar you can see some work done by previous students who attempted the task there was one PR by @c0derlint which had a good design example |
Oh okay @Ram81. But he had combined the login and signup form right? For me, I have to just create a sign up form? |
Is this fine @Ram81? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sayamkanwar in your current implementation how are you ensuring the security of password, I haven't worked on login functionality in react yet. Are there any standard methods used to handle password security in UI component ?
And can you also share some alternative mock ups too, this one is good but to me it doesn't seem fitting to Fabrik's theme.
ide/static/js/signup.js
Outdated
this.state = { | ||
error_username: 0, | ||
error_email: 0, | ||
error_password1: 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sayamkanwar please rename this variables, try not to use 1 or 2 with variable for multiple variables for same purpose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
ide/static/js/signup.js
Outdated
).style.borderColor = this.state.wrong; | ||
let email_label = document.getElementById("email-label"); | ||
if (email != "") { | ||
email_label.style.fontSize = "0.7em"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For style changes based on actions can't you create separate css class json in the component and change the style class of component ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll keep this in mind when coding the new design.
ide/static/js/signup.js
Outdated
this.setState({ error_email: 0 }); | ||
} | ||
} | ||
validatePassword1() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename methods based on logic in method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But there are 2-3 checks inside the method so how do I rename it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
based on the type of checks ex: validateEmailPassword
, etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Umm so if my validatePassword
function has 2 checks for empty string and maximum char length so I should name it as checkPasswordEmptyMaxChar
?
"csrfmiddlewaretoken" | ||
)[0].value; | ||
if ( | ||
this.state.error_username == 0 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you correct the indentation of this if ()
statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
ide/static/js/signup.js
Outdated
password2: password2 | ||
}, | ||
success: function(result) { | ||
console.log(result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove debugging logs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
ide/static/js/signup.js
Outdated
let success = document.getElementsByClassName("success")[0]; | ||
let rightImg = document.getElementsByClassName("graphic")[0]; | ||
let logo = document.getElementsByClassName("logo")[0]; | ||
setTimeout(function() {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add newlines to make code clean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
@Ram81, By security do you mean the prevention for different types of attacks through the input? |
@sayamkanwar yes |
Okay @Ram81, I'll add those checks. Thanks for pointing out! :) |
Do these 2 match Fabrik's theme? @Ram81 If you like these, please mention your choice as well. |
@sayamkanwar second one looks good for now |
@Ram81, okay I'll code this then. |
I have created the new design with all the changes you had asked for. I have also added the code to clean the string before submitting to the database which will prevent cyber security attacks. Also added all types of validation rules in the form. I have also added the code which gives an error if the account with the provided details already exists in the database. Please review @Ram81 @RishabhJain2018 |
Also, if you see any odd indentations, that's probably because of ESLint. Without those, I was getting webpack errors and warnings. |
}, | ||
success: function(result) { | ||
if (result.location == "/") { | ||
window.location = "/"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sayamkanwar we would want to set the logged in user details in user login component but we would want it to be done in a secure way can you try to figure out some method for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure @Ram81, I'll look into it.
@Ram81, Here's a demo on how this will work. So whenever we need to use them, we can simply read the item value from localStorage through javascript. Let me know your opinion on this. |
Hi,
I have created the signup page for Fabrik. I have added all the custom validation code. For csrf, I have used npm package
django-react-csrftoken
. The signup form should be available at/#/signup
.Here's a demo
Please review @Ram81 @RishabhJain2018 @yashdusing @utsavgarg
Thank you! :)