-
Notifications
You must be signed in to change notification settings - Fork 0
[#18] [API] As a user, I can register an account, [#17] [API] As a user, I can login #46
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
base: develop
Are you sure you want to change the base?
Conversation
| # frozen_string_literal: true | ||
|
|
||
| module Api | ||
| module V1 |
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.
| Has the name 'v1' |
| # frozen_string_literal: true | ||
|
|
||
| module Api | ||
| module V1 |
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.
| Has the name 'v1' |
| class UsersController < ApplicationController | ||
| skip_before_action :doorkeeper_authorize!, only: %i[create] | ||
|
|
||
| def create |
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.
| Has approx 6 statements |
| render(json: { user: user_data }) | ||
| end | ||
|
|
||
| def build_user_data(user, access_token) |
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.
| Doesn't depend on instance state (maybe move it to another class?) |
| # todo extract it inside authenticable | ||
| def self.authenticate(email, password) | ||
| user = User.find_for_authentication(email: email) | ||
| user&.valid_password?(password) ? user : nil |
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.
| Is controlled by argument 'password' |
|
Code coverage is now at 0.00% (0/165 lines) Generated by 🚫 Danger |
sanG-github
left a comment
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.
Just curiosity about Closes #17 in the description.
Login is also done in this PR 😀. |
Co-authored-by: Sang Huynh Thanh <63148598+sanG-github@users.noreply.github.com>
Closes #18
Closes #17
What happened 👀
Insight 📝
Proof Of Work 📹
Successful Registration
Duplicate Email
Invalid Password
Invalid client id
Login