-
Notifications
You must be signed in to change notification settings - Fork 77
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
[BE]Signup validations #70
Conversation
* adding the org setup * redirecting after org setup to the root page * adding the org setup * redirecting after org setup to the root page * minor fix * minor fix * did the functionality * added company_id * added controller * styled the org setup page without the two tabs * added the new schema with country and timezone in the model * added company factory * removed comments from factory * text field for business phone * deleted unwanted migrations * used up and down instead of change * model constraint added to companies migration * Company model validation added * schema and validation updated * company attribute and validation updated * remove logo_url coloumn from companies table * seed added and typo fixed * recreate gemfile.lock * unit test for company model added * removed test coverage * added linux arch in gemlock file * company routes added * role and user-company migration added * typo fixed in AddCompanyIdToUser * restored previous migration * removed null: false constraint from AddCompanyIdToUser * company form updated * replaced city-state gem with countries gem * conflict fix * Add minor changes * Dependent destroy added Co-authored-by: Akhil G Krishnan <akhilgkrishnan4u@gmail.com> Co-authored-by: Abinash Panda <abinashp@protonmail.ch>
* removed role attribute from user * removed roles from user * added rolify * fixed schema * code review changes
* Rails upgraded to 7.0.1 and Ruby upgraded to 3.1.0 * bundle lock fix
@apoorv-mishra can you rebase your branch with develop. Also please fix the confict. |
Current Code Coverage Percent of this PR:78.7 %Files having coverage below 100%
|
app/models/user.rb
Outdated
validates :first_name, :last_name, :email, :encrypted_password, presence: true | ||
validates :first_name, :last_name, | ||
presence: true, | ||
format: { with: /\A[a-zA-Z]+\z/, message: "First and last name must only contain letters" } |
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 move the message to en.yml
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.
Done.
…p error messages in locales
app/models/user.rb
Outdated
|
||
# Include default devise modules. Others available are: | ||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable | ||
devise :database_authenticatable, :registerable, | ||
:recoverable, :rememberable, :validatable, | ||
:trackable, :confirmable | ||
|
||
validates :email, format: { with: /^([^\s]+)((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, multiline: true } |
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 move all the validates in one place
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.
Done.
app/models/user.rb
Outdated
|
||
# Include default devise modules. Others available are: | ||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable | ||
devise :database_authenticatable, :registerable, | ||
:recoverable, :rememberable, :validatable, | ||
:trackable, :confirmable | ||
|
||
validates :email, format: { with: /^([^\s]+)((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, multiline: true } |
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.
We can replace the regex with devise's default regex inside devise.rb config.email_regexp
. Either replace the default value with this or use the default value from there itself.
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.
Done. Thanks for the tip @keshavbiswa . I was actually looking to override devise's default email validation since it's weaker and validates strings such as foo@bar
.
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.
LGTM 🎉 .
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.
LGTM! 👍🏻
Fixes #58
Preview: https://www.loom.com/share/cd12175924024089a30135cd0523283d