Skip to content
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

[#17] [API] As a User, I can sign up and sign in/out with a username and password #35

Merged
merged 129 commits into from Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from 123 commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
f97492e
[#17] Add user signup (create) API
malparty Jun 10, 2021
e75afba
[#17] Update doorkeeper scope to match API urls
malparty Jun 10, 2021
00a3068
[#17] Clean files and indents
malparty Jun 10, 2021
86995fa
[#17] Remove trailing spaces
malparty Jun 10, 2021
81269c4
[#17] Add basic request tests for OAuth token API requests
malparty Jun 11, 2021
fed6011
[#17] Add basic request tests for OAuth token refresh requests
malparty Jun 11, 2021
59a6f83
[#17] Add basic request tests for OAuth token revoke requests
malparty Jun 11, 2021
3f0d400
[#17] Reduce size of api/usercontroller/create action
malparty Jun 11, 2021
2f040d3
[#17] Rename doorkeeper spec to match controller name convention
malparty Jun 11, 2021
a90f84e
[#17] Add request tests for Api/v1/Users registration
malparty Jun 11, 2021
6e5e56f
[#17] Add request tests non valid password Users registration
malparty Jun 11, 2021
80258ee
[#17] Add request tests non valid client_id Users registration
malparty Jun 11, 2021
596e375
[#17] Refactor usercontroller to be easely readable
malparty Jun 11, 2021
47eb166
[#17] Refactor usercontroller to remove redundant code
malparty Jun 11, 2021
9919b94
[#17] Install jsonapi_serializer
malparty Jun 12, 2021
53cc18c
[#17] Use serializer in UserController
malparty Jun 12, 2021
aefddd9
[#17] Update users request tests to JsonApi format
malparty Jun 12, 2021
1a79490
[#17] Remove logic from controller to be in user model
malparty Jun 14, 2021
ce5de14
[#17] Remove logic from controller to be in user model
malparty Jun 14, 2021
85e7e83
Rebase from develop after user-login-backend PR routes
malparty Jun 16, 2021
29508c6
[#4] Add staging/prod url in Readme.me
malparty Jun 10, 2021
43653fa
[#4] Add aboud at the end of Readme.md
malparty Jun 10, 2021
23bf3fe
root commit
malparty Jun 11, 2021
68fd64f
Rebase from develop after user-login-backend PR pull
malparty Jun 16, 2021
59e3294
Rebase from develop after user-login-backend PR pull
malparty Jun 16, 2021
22d5cc9
Rebase from develop after user-login-backend PR pull
malparty Jun 16, 2021
2939cfd
Rebase from develop after user-login-backend PR pull
malparty Jun 16, 2021
5482046
[#5] Hide sign out button when not logged
malparty Jun 10, 2021
3193557
[#5] Add user db seed for system tests
malparty Jun 10, 2021
8ec9d33
Rebase from develop after user-login-backend PR pull railshelpers
malparty Jun 16, 2021
d216011
[#5] Fix missing password_confirmation param in sign_up request
malparty Jun 11, 2021
1e02d43
[#5] Add login and signup system tests
malparty Jun 11, 2021
c713787
[#5] Update system tests to use faster sign_in method helper
malparty Jun 14, 2021
814c9f5
[#5] Add FFaker to fabricate users
malparty Jun 14, 2021
dbc834f
[#5] Fix english mistakes in tests
malparty Jun 14, 2021
18c5ef4
[#5] Remove duplicated email validation rule
malparty Jun 14, 2021
309bfa9
[#5] Add missing line break in tests
malparty Jun 14, 2021
d031c29
root commit
malparty Jun 11, 2021
e947577
[#5] Remove module prefix I18n in views
malparty Jun 14, 2021
31f2cb7
Rebase from develop after user-login-backend PR pull citext enable
malparty Jun 16, 2021
5da3b42
Rebase from develop after user-login-backend PR pull rename last_name…
malparty Jun 16, 2021
dec8deb
Rebase from develop after user-login-backend PR pull rename last_name…
malparty Jun 16, 2021
ac4f5fb
[#5] Fix spacing for clarity in authentication helper
malparty Jun 14, 2021
8c08a1a
Rebase from develop after user-login-backend PR pull delete db schema
malparty Jun 16, 2021
f5e3d49
Rebase from develop after user-login-backend PR pull db schema
malparty Jun 16, 2021
76d6f9f
Rebase from develop after user-login-backend PR pull
malparty Jun 16, 2021
57ff17f
Rebase from develop after user-login-backend PR pull
malparty Jun 16, 2021
743e88f
Rebase from develop after user-login-backend PR pull
malparty Jun 16, 2021
7f0e2e8
After rebase - fix Rubocop warnings
malparty Jun 16, 2021
bff13a5
[#17] Update code to match last_name first_name
malparty Jun 16, 2021
9926027
[#17] Rename Api module into API
malparty Jun 16, 2021
b7dc548
Merge branch 'develop' into feature/user-login-api
malparty Jun 16, 2021
9395728
[#17] Remove duplicates usage of devise_params allowed. Fix api/users…
malparty Jun 17, 2021
beac349
[#17] Handle users#create errors with JSON::API compliance
malparty Jun 17, 2021
166a8d6
[#17] Update request tests pluralize error in api errors
malparty Jun 17, 2021
0b00308
[#17] Fix tests and rubocop
malparty Jun 17, 2021
890f84a
[#17] Remove useless fields in rspec/fixtures
malparty Jun 17, 2021
cce7a17
[#17] Remove duplicated include in rails_helper
malparty Jun 17, 2021
999727a
[#17] Correct english mistakes in tests
malparty Jun 17, 2021
e2f5aa4
[#17] Replace string by symbol for request test path
malparty Jun 17, 2021
d530def
[#17] Fix test spellings
malparty Jun 17, 2021
631eaf6
[#17] Use inline code to declare params for tests
malparty Jun 17, 2021
e65f3e0
[#17] Apply JSON API for doorkeeper revoke error
malparty Jun 17, 2021
6b0e495
[#17] Apply JSON::API conventions to TokenController
malparty Jun 17, 2021
cdd2fb0
[#17] Remove extra logger debug call
malparty Jun 17, 2021
21f27cb
[#17] Refactor code and test to be more reusable
malparty Jun 18, 2021
f4ce0ec
[#17] Handle token errors jsonapi format in a cleaner way
malparty Jun 18, 2021
6a8545e
[#17] Handle token create success with clean jsonapi format
malparty Jun 18, 2021
8664a6a
[#17] Update user.errors serializer to handle separation of concerns
malparty Jun 18, 2021
b097079
[#17] Simplify test code with inline declarations
malparty Jun 18, 2021
371662e
[#17] Simplify test code with inline declarations in token controller…
malparty Jun 18, 2021
620ff08
[#17] Add line for clarity. remove .keep
malparty Jun 18, 2021
b8c21d7
[#17] Replace after_action callback by cleaner action rewrite
malparty Jun 18, 2021
37746e6
[#17] Rename get_access_token to create_access_token in User
malparty Jun 18, 2021
9ed7498
[#17] Refactor user_token serializer
malparty Jun 21, 2021
091071a
[#17] Refactor user_controller to use before_action check client valid
malparty Jun 21, 2021
0f2f047
Add Run undercover before run danger in Review workflow
malparty Jun 18, 2021
1b0f338
Add Run undercover before run danger in Review workflow
malparty Jun 18, 2021
4dcfd37
Add Run rspec to generate code coverage data
malparty Jun 18, 2021
7af1da4
Add Run rspec to generate code coverage data
malparty Jun 18, 2021
a1182ae
Refactor workflow review to use docker container
malparty Jun 18, 2021
751713e
Add missing env var
malparty Jun 18, 2021
4b286f2
Add missing docker-compase.yml
malparty Jun 18, 2021
5b08129
Comment undercover in dangerfile
malparty Jun 18, 2021
1a89c85
Comment undercover in dangerfile - simplecov.report
malparty Jun 18, 2021
67c283f
Adding false positive for package vulnerability warning
malparty Jun 18, 2021
64a80d4
Update ignore comment
malparty Jun 18, 2021
64b9113
[#17] Add user signup (create) API
malparty Jun 10, 2021
130f647
[#17] Add basic request tests for OAuth token API requests
malparty Jun 11, 2021
1773c0d
[#17] Add basic request tests for OAuth token revoke requests
malparty Jun 11, 2021
2febf3e
root commit
malparty Jun 11, 2021
1645d7f
Rebase from develop after user-login-backend PR pull
malparty Jun 16, 2021
779d542
Rebase from develop after user-login-backend PR pull
malparty Jun 16, 2021
ab7776f
Rebase from develop after user-login-backend PR pull railshelpers
malparty Jun 16, 2021
eb235c7
[#5] Add login and signup system tests
malparty Jun 11, 2021
65eeef9
[#5] Update system tests to use faster sign_in method helper
malparty Jun 14, 2021
22f2413
[#5] Add FFaker to fabricate users
malparty Jun 14, 2021
068d919
root commit
malparty Jun 11, 2021
1ad9306
Rebase from develop after user-login-backend PR pull citext enable
malparty Jun 16, 2021
e5ac9f4
Rebase from develop after user-login-backend PR pull rename last_name…
malparty Jun 16, 2021
67c7975
Rebase from develop after user-login-backend PR pull rename last_name…
malparty Jun 16, 2021
08aa140
Rebase from develop after user-login-backend PR pull db schema
malparty Jun 16, 2021
03b609c
Rebase from develop after user-login-backend PR pull
malparty Jun 16, 2021
9aea781
Rebase from develop after user-login-backend PR pull
malparty Jun 16, 2021
e7ab39b
[#17] Remove duplicated include in rails_helper
malparty Jun 17, 2021
a61fca6
[#17] Solve issues after rebase
malparty Jun 21, 2021
06e8bbf
[#17] Add client secret check in client validation
malparty Jun 21, 2021
5f7c4f2
[#17] Simplify spec code removing extra { }
malparty Jun 21, 2021
779a99f
[#17] Open routes to doorkeeper application UI. Close routes to token…
malparty Jun 21, 2021
ad6885f
[#17] Replace single quote by symbol in test helpers
malparty Jun 21, 2021
963f984
[#6] Add is_admin to user
malparty Jun 21, 2021
6f08ddf
[#6] Remove serializable_hash inside render json statements
malparty Jun 21, 2021
5842b42
[#17] Remove to_time useless cast
malparty Jun 22, 2021
f4fd89d
[#17] Add index and null false to is_admin users
malparty Jun 22, 2021
c9ddc5a
[#17] Add predicate to is_admin?
malparty Jun 22, 2021
6147302
[#17] Remove duplicate Oauth helper inclusion
malparty Jun 22, 2021
e264e5a
[#17] Fix wrong attr access from @id to self[:id]
malparty Jun 22, 2021
d4072fd
[#17] Remove useless devise concern in API namespace
malparty Jun 22, 2021
5b1ae4c
[#17] Simplify appcontroller inheritance inside API V1 controllers
malparty Jun 22, 2021
83c71ad
[#17] Simplify wrong attr access from self[:id] to id
malparty Jun 22, 2021
063ab78
[#17] Update error serializer with as_json method
malparty Jun 22, 2021
650c4d4
[#17] Add comments when overridden doorkeeper methods
malparty Jun 23, 2021
f94ac72
[#17] Improve user_controller spec with nested contexts
malparty Jun 23, 2021
55fc4ca
[#17] Improve tokens_controller spec with nested contexts
malparty Jun 23, 2021
4327371
[#17] Improve login specs with nested contexts
malparty Jun 23, 2021
9ad10f0
[#17] Improve signup specs with nested contexts
malparty Jun 23, 2021
02ac41a
[#17] Improve users#create if/else condition for clarity
malparty Jun 23, 2021
05efabb
[#17] Replace non valid by invalid
malparty Jun 23, 2021
b0a1dfa
[#17] Prefer non bang method unless no other choice
malparty Jun 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions Dangerfile
Expand Up @@ -19,7 +19,8 @@ suggester.suggest
eslint.lint

# Report your Ruby app test suite code coverage in Danger.
simplecov.report 'coverage/coverage.json'
# simplecov.report 'coverage/coverage.json'

# Report missing test coverage of new changes in Danger
undercover.report
# Commented as undercover reports needs tests to run, which needs a different env
# undercover.report
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -13,6 +13,7 @@ gem 'fabrication' # Fabrication generates objects in Ruby. Fabricators are schem
gem 'sidekiq' # background processing for Ruby
gem 'bootsnap', require: false # Reduces boot times through caching; required in config/boot.rb
gem 'i18n-js', '3.5.1' # A library to provide the I18n translations on the Javascript
gem 'jsonapi-serializer' # A fast JSON:API serializer for Ruby Objects.

# Authentications & Authorizations
gem 'devise' # Authentication solution for Rails with Warden
Expand Down Expand Up @@ -53,7 +54,6 @@ group :development, :test do
gem 'rubocop-rails', require: false # A RuboCop extension focused on enforcing Rails best practices and coding conventions.
gem 'rubocop-rspec', require: false # Code style checking for RSpec files
gem 'rubocop-performance', require: false # An extension of RuboCop focused on code performance checks.
gem 'ffaker' # used to easily generate fake data: names, addresses, phone numbers, etc.
junan marked this conversation as resolved.
Show resolved Hide resolved

gem 'undercover' # Report missing test coverage in new changes
gem 'danger' # Automated code review.
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Expand Up @@ -198,6 +198,8 @@ GEM
json_matchers (0.11.1)
json_schema
json_schema (0.21.0)
jsonapi-serializer (2.2.0)
activesupport (>= 4.2)
kramdown (2.3.1)
rexml
kramdown-parser-gfm (1.1.0)
Expand Down Expand Up @@ -489,6 +491,7 @@ DEPENDENCIES
foreman
i18n-js (= 3.5.1)
json_matchers
jsonapi-serializer
letter_opener
listen (= 3.1.5)
mini_magick
Expand Down
17 changes: 17 additions & 0 deletions app/controllers/api/v1/application_controller.rb
@@ -0,0 +1,17 @@
# frozen_string_literal: true

module API
module V1
malparty marked this conversation as resolved.
Show resolved Hide resolved
class ApplicationController < ActionController::API
malparty marked this conversation as resolved.
Show resolved Hide resolved
malparty marked this conversation as resolved.
Show resolved Hide resolved
# equivalent of authenticate_user! on devise, but this one will check the oauth token
before_action :doorkeeper_authorize!

private

# helper method to access the current user from the token
def current_user
malparty marked this conversation as resolved.
Show resolved Hide resolved
@current_user ||= User.find_by(id: doorkeeper_token[:resource_owner_id])
end
end
end
end
41 changes: 41 additions & 0 deletions app/controllers/api/v1/tokens_controller.rb
@@ -0,0 +1,41 @@
# frozen_string_literal: true

module API
module V1
malparty marked this conversation as resolved.
Show resolved Hide resolved
class TokensController < Doorkeeper::TokensController
include ErrorHandlerConcern

# Overridden from doorkeeper as the doorkeeper revoke action does not return response according to json-api spec
def revoke
Copy link

@github-actions github-actions bot Jun 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Remove unused methods (api::v1::tokenscontroller#revoke)

malparty marked this conversation as resolved.
Show resolved Hide resolved
malparty marked this conversation as resolved.
Show resolved Hide resolved
Copy link

@github-actions github-actions bot Jun 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Remove unused methods (api::v1::tokenscontroller#revoke)

# The authorization server responds with HTTP status code 200 if the client
# submitted an invalid token or the token has been revoked successfully.
if token.blank?
render json: token_revoke_response, status: :ok
Copy link

@github-actions github-actions bot Jun 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Calls 'render json: token_revoke_response, status: :ok' 2 times

# The authorization server validates [...] and whether the token
# was issued to the client making the revocation request. If this
# validation fails, the request is refused and the client is informed
# of the error by the authorization server as described below.
elsif authorized?
revoke_token
render json: token_revoke_response, status: :ok
Copy link

@github-actions github-actions bot Jun 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Calls 'render json: token_revoke_response, status: :ok' 2 times

else
render json: revocation_error_response, status: :forbidden
end
end

private

# Overridden from doorkeeper as it does not return response according to json-api spec
def revocation_error_response
error_description = I18n.t(:unauthorized, scope: %i[doorkeeper errors messages revoke])
{
errors: build_error(detail: error_description, code: :invalid_client)
}
end

def token_revoke_response
Copy link

@github-actions github-actions bot Jun 23, 2021

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?)

{ meta: I18n.t('doorkeeper.token_revoked') }
end
end
end
end
35 changes: 35 additions & 0 deletions app/controllers/api/v1/users_controller.rb
@@ -0,0 +1,35 @@
# frozen_string_literal: true

module API
module V1
malparty marked this conversation as resolved.
Show resolved Hide resolved
class UsersController < ApplicationController
include API::V1::ErrorHandlerConcern

skip_before_action :doorkeeper_authorize!, only: :create

before_action :ensure_valid_client, only: :create

def create
junan marked this conversation as resolved.
Show resolved Hide resolved
user = User.new(create_params.except(:client_id, :client_secret))

render json: ActiveModel::ErrorsSerializer.new(user.errors) and return unless user.save

render json: UserTokenSerializer.new(user, { params: { client_id: @client_app.id } }),
status: :created
end

private

def create_params
params.permit(:email, :password, :last_name, :first_name, :client_id, :client_secret)
end

def ensure_valid_client
@client_app = Doorkeeper::Application.by_uid_and_secret(create_params[:client_id],
create_params[:client_secret])

render_error 'Invalid client credentials', status: :forbidden, source: :client_id if @client_app.blank?
end
end
end
end
12 changes: 1 addition & 11 deletions app/controllers/application_controller.rb
Expand Up @@ -2,20 +2,10 @@

class ApplicationController < ActionController::Base
include Localization
include DeviseParameter

protect_from_forgery with: :exception

before_action :authenticate_user!
before_action :update_allowed_parameters, if: :devise_controller?

protected

def update_allowed_parameters
devise_parameter_sanitizer.permit(:sign_up) do |u|
u.permit(:first_name, :last_name, :email, :password, :password_confirmation)
end
devise_parameter_sanitizer.permit(:account_update) do |u|
u.permit(:first_name, :last_name, :email, :password, :current_password)
end
end
end
Empty file removed app/controllers/concerns/.keep
Empty file.
29 changes: 29 additions & 0 deletions app/controllers/concerns/api/v1/error_handler_concern.rb
@@ -0,0 +1,29 @@
# frozen_string_literal: true

module API
module V1
malparty marked this conversation as resolved.
Show resolved Hide resolved
module ErrorHandlerConcern
extend ActiveSupport::Concern

private

# Render Error Message in json_api format
def render_error(detail, source: nil, status: :unprocessable_entity)
error = build_error(detail: detail, source: source)
render_errors [error], status
end

def render_errors(jsonapi_errors, status = :unprocessable_entity)
render json: { errors: jsonapi_errors }, status: status
end

def build_error(detail:, source: nil, code: nil)
malparty marked this conversation as resolved.
Show resolved Hide resolved
{
source: source,
detail: detail,
code: code
}.compact
end
end
end
end
14 changes: 14 additions & 0 deletions app/controllers/concerns/devise_parameter.rb
@@ -0,0 +1,14 @@
# frozen_string_literal: true

module DeviseParameter
protected

def update_allowed_parameters
malparty marked this conversation as resolved.
Show resolved Hide resolved
devise_parameter_sanitizer.permit(:sign_up) do |u|
malparty marked this conversation as resolved.
Show resolved Hide resolved
u.permit(:first_name, :last_name, :email, :password, :password_confirmation)
end
devise_parameter_sanitizer.permit(:account_update) do |u|
malparty marked this conversation as resolved.
Show resolved Hide resolved
u.permit(:first_name, :last_name, :email, :password, :current_password)
end
end
end
21 changes: 21 additions & 0 deletions app/models/user.rb
Expand Up @@ -11,4 +11,25 @@ def self.authenticate(email, password)
user = User.find_for_authentication(email: email)
user&.valid_password?(password) ? user : nil
malparty marked this conversation as resolved.
Show resolved Hide resolved
end

def create_access_token(client_app_id)
malparty marked this conversation as resolved.
Show resolved Hide resolved
Doorkeeper::AccessToken.create(
resource_owner_id: id,
application_id: client_app_id,
refresh_token: generate_refresh_token,
expires_in: Doorkeeper.configuration.access_token_expires_in.to_i,
scopes: ''
)
end

private

def generate_refresh_token
loop do
# generate a random token string and return it,
# unless there is already another token with the same string
token = SecureRandom.hex(32)
break token unless Doorkeeper::AccessToken.exists?(refresh_token: token)
end
end
end
13 changes: 13 additions & 0 deletions app/serializers/active_model/errors_serializer.rb
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module ActiveModel
class ErrorsSerializer
def initialize(errors)
@errors = errors
end

def as_json(_options = nil)
{ errors: @errors.errors.map { |e| { detail: e.full_message, source: e.attribute } } }
malparty marked this conversation as resolved.
Show resolved Hide resolved
malparty marked this conversation as resolved.
Show resolved Hide resolved
end
end
end
13 changes: 13 additions & 0 deletions app/serializers/doorkeeper/token_serializer.rb
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Doorkeeper
class TokenSerializer
include JSONAPI::Serializer

attributes :token, :token_type, :expires_in, :refresh_token
malparty marked this conversation as resolved.
Show resolved Hide resolved
malparty marked this conversation as resolved.
Show resolved Hide resolved

attribute :created_at do |token|
token.created_at.to_i
end
end
end
7 changes: 7 additions & 0 deletions app/serializers/user_serializer.rb
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class UserSerializer
include JSONAPI::Serializer
malparty marked this conversation as resolved.
Show resolved Hide resolved

attributes :email, :last_name, :first_name
end
9 changes: 9 additions & 0 deletions app/serializers/user_token_serializer.rb
@@ -0,0 +1,9 @@
# frozen_string_literal: true

class UserTokenSerializer < UserSerializer
set_type :user

attribute :access_token do |user, params|
Doorkeeper::TokenSerializer.new(user.create_access_token(params[:client_id])).serializable_hash[:data]
end
end
14 changes: 7 additions & 7 deletions app/views/devise/registrations/edit.html.erb
Expand Up @@ -4,17 +4,17 @@
<%= render "devise/shared/error_messages", resource: resource %>

<div class="field">
<%= f.label :first_name %><br />
<%= f.label :first_name %><br/>
<%= f.text_field :first_name, autofocus: true %>
</div>

<div class="field">
<%= f.label :last_name %><br />
<%= f.label :last_name %><br/>
<%= f.text_field :last_name %>
</div>

<div class="field">
<%= f.label :email %><br />
<%= f.label :email %><br/>
<%= f.email_field :email, autocomplete: "email" %>
</div>

Expand All @@ -23,21 +23,21 @@
<% end %>

<div class="field">
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br/>
<%= f.password_field :password, autocomplete: "new-password" %>
<% if @minimum_password_length %>
<br />
<br/>
<em><%= @minimum_password_length %> characters minimum</em>
<% end %>
</div>

<div class="field">
<%= f.label :password_confirmation %><br />
<%= f.label :password_confirmation %><br/>
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
</div>

<div class="field">
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br/>
<%= f.password_field :current_password, autocomplete: "current-password" %>
</div>

Expand Down
12 changes: 6 additions & 6 deletions app/views/devise/registrations/new.html.erb
Expand Up @@ -4,30 +4,30 @@
<%= render "devise/shared/error_messages", resource: resource %>

<div class="field">
<%= f.label :first_name %><br />
<%= f.label :first_name %><br/>
<%= f.text_field :first_name, autofocus: true %>
</div>

<div class="field">
<%= f.label :last_name %><br />
<%= f.label :last_name %><br/>
<%= f.text_field :last_name %>
</div>

<div class="field">
<%= f.label :email %><br />
<%= f.label :email %><br/>
<%= f.email_field :email, autocomplete: "email" %>
</div>

<div class="field">
<%= f.label :password %>
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em>
<% end %><br />
<em>(<%= @minimum_password_length %> characters minimum)</em>
<% end %><br/>
<%= f.password_field :password, autocomplete: "new-password" %>
</div>

<div class="field">
<%= f.label :password_confirmation %><br />
<%= f.label :password_confirmation %><br/>
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
</div>

Expand Down
22 changes: 22 additions & 0 deletions config/brakeman.ignore
@@ -0,0 +1,22 @@
{
"ignored_warnings": [
{
"warning_type": "Cross-Site Scripting",
"warning_code": 106,
"fingerprint": "c8adc1c0caf2c9251d1d8de588fb949070212d0eed5e1580aee88bab2287b772",
"check_name": "SanitizeMethods",
"message": "loofah gem 2.10.0 is vulnerable (CVE-2018-8048). Upgrade to 2.2.1",
"file": "Gemfile.lock",
"line": 214,
"link": "https://github.com/flavorjones/loofah/issues/144",
"code": null,
"render_path": null,
"location": null,
"user_input": null,
"confidence": "Medium",
"note": "2.10.0 is HIGHER than 2.2.1, thus already patched!"
}
],
"updated": "2021-06-18 15:28:26 +0700",
"brakeman_version": "5.0.1"
}