-
Notifications
You must be signed in to change notification settings - Fork 1
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
Authenticate/Inviting #1
Changes from 5 commits
43f01d3
e11e918
8b90bd0
e01c889
6a03799
7951cc4
bd382a8
3541741
945b275
209a94b
2429958
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,13 @@ | ||
# README | ||
## Getting Started | ||
|
||
This README would normally document whatever steps are necessary to get the | ||
application up and running. | ||
This section provides quick start guide. | ||
|
||
Things you may want to cover: | ||
### Prerequisites | ||
|
||
* Ruby version | ||
- [Ruby](https://www.ruby-lang.org/en/): 2.6.3 | ||
- [Ruby on Rails](https://rubyonrails.org/): 2.6.3 | ||
- [PostgreSQL](https://www.postgresql.org/) 9.4 or higher. | ||
|
||
* System dependencies | ||
### Standard Installation | ||
|
||
* Configuration | ||
|
||
* Database creation | ||
|
||
* Database initialization | ||
|
||
* How to run the test suite | ||
|
||
* Services (job queues, cache servers, search engines, etc.) | ||
|
||
* Deployment instructions | ||
|
||
* ... | ||
1. `bin/setup` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
class HomeController < ApplicationController | ||
before_action :authenticate_user! | ||
# GET / | ||
def homepage | ||
render json: { success: 'ok' }, status: :ok | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
class InvitesController < ApplicationController | ||
before_action :authenticate_user! | ||
|
||
# GET /invite | ||
def invite | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. такое название метода не по REST. |
||
User.invite!(email: '[email protected]', fullname: 'John Doe') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. почему email захардкожен? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Из-за того, что логики пока никакой нет. |
||
render json: { success: 'invite sent' }, status: :ok | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
class User < ApplicationRecord | ||
devise :database_authenticatable, :registerable, | ||
:recoverable, :rememberable, :validatable, | ||
:invitable | ||
|
||
validates :email, :password, presence: true | ||
validates :email, uniqueness: true | ||
validates :password, length: { in: 8..20 } | ||
end |
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.
это имеет смысл перенести в application_controller