Skip to content

Commit

Permalink
rubocop lint
Browse files Browse the repository at this point in the history
  • Loading branch information
simonfranzen committed Sep 20, 2020
1 parent 21d0e48 commit aa9fc38
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This is a boilerplate to build your next SaaS product. It's a RubyOnRails 6 back
This boilerplate works like a charm with the following gems:
- pg
- devise
- devise_invitable
- graphql
- graphql-auth
- graphql-errors
Expand Down Expand Up @@ -84,7 +85,12 @@ The app uses a PostgreSQL database. It implements the connector with the gem `pg
### 2. Authentication
The app uses [devise](https://github.com/plataformatec/devise)'s logic for authentication. For graphQL API we use the JWT token, but to access the rails_admin backend we use standard devise views, but registration is excluded.

Change devise settins under `config/initializers/devise.rb` and `config/initializers/graphql_auth.rb`.
Change devise settings under `config/initializers/devise.rb` and `config/initializers/graphql_auth.rb`.

#### Invitations
Admins of a company can invite new users. The process is handled with `devise_invitable`. We added a `inviteUser` and `acceptInvite` mutation to handle this process via graphql.

Like in the reset password process we redirect the users to the frontend domain and not to backend.


### 3. JSON Web Token
Expand Down
2 changes: 0 additions & 2 deletions app/controllers/auth/invitations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
module Auth
# Custom passwords controller
class InvitationsController < Devise::InvitationsController

# GET /resource/invitation/accept?invitation_token=abcdef
# redirect user to front end to finish invitation
def edit
redirect_to "http://#{ENV['CLIENT_URL']}/users/invitation/accept?invitation_token=#{params[:invitation_token]}"
end

end
end
4 changes: 3 additions & 1 deletion app/controllers/auth/passwords_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

# rubocop:disable Layout/LineLength
module Auth
# Custom passwords controller
class PasswordsController < Devise::PasswordsController
Expand All @@ -9,4 +10,5 @@ def edit
redirect_to "http://#{ENV['CLIENT_URL']}/users/password/edit?reset_password_token=#{params[:reset_password_token]}"
end
end
end
end
# rubocop:enable Layout/LineLength
File renamed without changes.

0 comments on commit aa9fc38

Please sign in to comment.