Skip to content

Conversation

@mosharaf13
Copy link
Contributor

@mosharaf13 mosharaf13 commented Jun 15, 2023

Closes #18
Closes #17

What happened 👀

  • Add user registration through api
  • Add token issue mechanism

Insight 📝

  • Added doorkeeper gem
  • Created api module
  • Added user controller on api module to handle user registration through api

Proof Of Work 📹

Successful Registration Screen Shot 2023-06-15 at 6 00 01 PM
Duplicate Email Screen Shot 2023-06-15 at 6 00 16 PM
Invalid Password Screen Shot 2023-06-15 at 6 00 36 PM
Invalid client id Screen Shot 2023-06-15 at 6 00 44 PM
Login Screen Shot 2023-06-16 at 11 44 51 AM

@mosharaf13 mosharaf13 added this to the 0.5.0 milestone Jun 15, 2023
@mosharaf13 mosharaf13 requested a review from a user June 15, 2023 11:10
@mosharaf13 mosharaf13 requested a review from longnd as a code owner June 15, 2023 11:10
@mosharaf13 mosharaf13 self-assigned this Jun 15, 2023
@mosharaf13 mosharaf13 requested a review from sanG-github as a code owner June 15, 2023 11:10
# frozen_string_literal: true

module Api
module V1
Copy link

@github-actions github-actions bot Jun 15, 2023

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
Copy link

@github-actions github-actions bot Jun 15, 2023

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
Copy link

@github-actions github-actions bot Jun 15, 2023

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)
Copy link

@github-actions github-actions bot Jun 15, 2023

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
Copy link

@github-actions github-actions bot Jun 15, 2023

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'

@github-actions
Copy link

Code coverage is now at 0.00% (0/165 lines)

Generated by 🚫 Danger

Copy link
Collaborator

@sanG-github sanG-github left a 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.

@mosharaf13
Copy link
Contributor Author

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>
Base automatically changed from ui/list-keywords to develop June 23, 2023 03:42
@mosharaf13 mosharaf13 changed the title [#18] [API] As a user, I can register an account [#18] [API] As a user, I can register an account, [#17] [API] As a user, I can login Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants