mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
New accounts only from an administrator or an administrator's invitation
Anyone can add an aircraft and so manage its people, so invitations from non-administrators could bring in new accounts without an administrator. - An invitation makes a new account only if whoever made it is still an administrator when it's used; an aircraft's Access page invitations are for people who already have an account (its welcome page says so). - Signing invitations no longer make accounts: the mechanic needs one first, and the owner is told when they don't have one. - With SSO, "Continue with <provider>" on an administrator's invitation makes the account and accepts the invitation (only for its address when it has one), so invitations work without OIDC_AUTO_CREATE_USERS. That setting stays, documented as giving accounts without an invitation; the Authentik example now leaves it off. - Docs: who makes accounts (guide, README, Authentik, .env.example, API). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b4c7aaa3ff
commit
19bc3efa19
19 files changed
+159
-85
No files matched your search
@@ -1,11 +1,11 @@
|
||||
# The invited signer's side: sign in (or create an account for the invited
|
||||
# address), add a certificate if needed, review the entry and sign it. The
|
||||
# invitation gives access to that one entry only.
|
||||
# The invited signer's side: sign in with their account for the invited
|
||||
# address, add a certificate if needed, review the entry and sign it. The
|
||||
# invitation gives access to that one entry only. It doesn't make accounts:
|
||||
# only an administrator (or an administrator's invitation) does.
|
||||
class InvitedSigningsController < ApplicationController
|
||||
include EntrySigning
|
||||
allow_unauthenticated_access only: %i[show account]
|
||||
allow_unauthenticated_access only: :show
|
||||
before_action :set_invitation
|
||||
rate_limit to: 10, within: 15.minutes, only: :account, with: -> { redirect_to new_session_path, alert: t("flash.invited_signings.try_again_later") }
|
||||
|
||||
def show
|
||||
@entry = @invitation.logbook_entry
|
||||
@@ -20,24 +20,6 @@ class InvitedSigningsController < ApplicationController
|
||||
render :new
|
||||
end
|
||||
|
||||
# Creating an account for the invited email address.
|
||||
def account
|
||||
return redirect_to(invited_signing_path(params[:token])) if authenticated?
|
||||
if User.exists?(email_address: @invitation.email) || !Sso.password_login?
|
||||
return redirect_to invited_signing_path(params[:token]), alert: t("flash.invited_signings.sign_in_to_continue")
|
||||
end
|
||||
user = User.new(params.permit(:name, :password, :password_confirmation).merge(email_address: @invitation.email))
|
||||
if user.save
|
||||
reset_session
|
||||
start_new_session_for user
|
||||
redirect_to invited_signing_path(params[:token]), notice: t("flash.invited_signings.account_created_add_your")
|
||||
else
|
||||
@entry = @invitation.logbook_entry
|
||||
@account_errors = user.errors.full_messages
|
||||
render :welcome, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@entry = @invitation.logbook_entry
|
||||
@aircraft = @entry.aircraft
|
||||
|
||||
Reference in new issue
Block a user