This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// frontend/app/routes/accept-invitation.js | |
import Ember from 'ember'; | |
import config from '../config/environment'; | |
const { inject: { service }, isEmpty } = Ember; | |
export default Ember.Route.extend({ | |
session: service('session'), | |
beforeModel() { | |
if (this.get('session.isAuthenticated')) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// frontend/app/router.js | |
import Ember from 'ember'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: config.locationType, | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backend/config/routes.rb | |
Rails.application.routes.draw do | |
devise_for :users, controllers: { invitations: 'users_invitations' } | |
# ... | |
root to: 'application#root' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backend/app/controllers/users_invitations_controller.rb | |
class UsersInvitationsController < Devise::InvitationsController | |
before_action :configure_permitted_parameters | |
# ... | |
private | |
def configure_permitted_parameters | |
devise_parameter_sanitizer.permit(:accept_invitation, keys: [:first_name, :last_name]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backend/app/controllers/users_invitations_controller.rb | |
class UsersInvitationsController < Devise::InvitationsController | |
def edit | |
sign_out send("current_#{resource_name}") if send("#{resource_name}_signed_in?") | |
set_minimum_password_length | |
resource.invitation_token = params[:invitation_token] | |
redirect_to "http://localhost:8080/users/invitation/accept?invitation_token=#{params[:invitation_token]}" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backend/app/controllers/users_invitations_controller.rb | |
class UsersInvitationsController < ApplicationController | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# path_sub, path_beg, path_end are the ones I'll likely want to use again. | |
# ACL Docs: https://cbonte.github.io/haproxy-dconv/configuration-1.5.html#7.1 | |
acl sync_req path_sub config_settings | |
redirect prefix https://artisantools.com if sync_req |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Heavily inspired by: | |
# scout_statsd_rack -- https://github.com/scoutapp/scout_statsd_rack/blob/master/lib/scout_statsd_rack.rb | |
# trashed -- https://github.com/basecamp/trashed | |
# Add to Rails App: `config.middleware.use RackStats` | |
class RackStats | |
attr_accessor :app | |
def initialize(app) | |
@app = app | |
end |