Skip to content

feat: Add user creation and editing functionality with LiveView - #1

Merged
ddon merged 1 commit into
BeamLabEU:mainfrom
timujinne:main
Sep 1, 2025
Merged

feat: Add user creation and editing functionality with LiveView#1
ddon merged 1 commit into
BeamLabEU:mainfrom
timujinne:main

Conversation

@timujinne

Copy link
Copy Markdown
Contributor
  • Introduced new LiveView for user forms to handle both creation and editing of users.
  • Updated routes to include paths for creating and editing users.
  • Removed modal for user creation and replaced it with a dedicated form.
  • Implemented password reset functionality for user management.
  • Cleaned up user management LiveView by removing unused modal logic and parameters.
  • Added migration to remove is_active column from role assignments, simplifying role management.
  • Updated version to 1.1.0 and improved project description in mix.exs.

- Introduced new LiveView for user forms to handle both creation and editing of users.
- Updated routes to include paths for creating and editing users.
- Removed modal for user creation and replaced it with a dedicated form.
- Implemented password reset functionality for user management.
- Cleaned up user management LiveView by removing unused modal logic and parameters.
- Added migration to remove is_active column from role assignments, simplifying role management.
- Updated version to 1.1.0 and improved project description in mix.exs.
@ddon
ddon merged commit 9989d84 into BeamLabEU:mainSep 1, 2025
timujinne referenced this pull request in timujinne/phoenix_kit Oct 26, 2025
## Problem #1: OAuth halt() missing (CRITICAL)
Fixed missing halt(conn) call in handle_oauth_request() that caused 500 errors
when users clicked OAuth sign-in buttons. Phoenix would attempt to render a
non-existent view template after Ueberauth processed the request.
Modified: lib/phoenix_kit_web/users/oauth.ex:105
## Problem #2: IPv6 Protocol.UndefinedError (HIGH PRIORITY)
Created centralized PhoenixKit.Utils.IpAddress module to prevent
Protocol.UndefinedError when extracting IPv6 addresses.
Root cause: Six files had duplicate extract_ip_address() functions calling
to_string(address) on IPv6 tuples without proper guard clauses. This caused:
Protocol.UndefinedError: String.Chars not implemented for IPv6 tuples
Solution:
- Created lib/phoenix_kit/utils/ip_address.ex with proper pattern matching:
* IPv4: {a, b, c, d} pattern with is_integer guards
* IPv6: {a, b, c, d, e, f, g, h} pattern with is_integer guards
* Invalid/nil: returns "unknown"
- Removed duplicate implementations from 7 files:
* lib/phoenix_kit_web/live/dashboard.ex
* lib/phoenix_kit_web/users/login.ex
* lib/phoenix_kit_web/users/registration.ex
* lib/phoenix_kit_web/users/magic_link.ex
* lib/phoenix_kit_web/live/users/live_sessions.ex
* lib/phoenix_kit/utils/geolocation.ex
* lib/phoenix_kit_web/users/oauth.ex
- Updated all call sites to use IpAddress.extract_from_socket() or
IpAddress.extract_from_conn() for consistency
## Problem #3: OAuth config not loading at startup
Already fixed in current version (integration.ex:442-463).
phoenix_kit_routes() macro spawns task that calls OAuthConfig.configure_providers()
with 100ms delay to ensure database is ready.
## Code Quality
- Fixed all Credo compilation warnings (alias ordering, number formatting)
- Comprehensive unit tests added (17 test cases covering IPv4, IPv6, edge cases)
- All tests passing
- No compilation errors or warnings
timujinne referenced this pull request in timujinne/phoenix_kit Oct 29, 2025
Issue #1: Preserve Ueberauth base_path during configuration
- Function configure_ueberauth_base/0 now preserves existing base_path
- Added get_oauth_base_path/0 helper to set default based on URL prefix
- Prevents "Ueberauth plugin did not process request" error
Issue #2: Fix struct field access using bracket notation
- Replaced auth.credentials[:token] with auth.credentials.token
- Replaced auth.credentials[:refresh_token] with auth.credentials.refresh_token
- Replaced auth.extra[:raw_info] with safe get_raw_info/1 helper
- Fixes UndefinedFunctionError when OAuth callback processes response
These changes eliminate critical bugs that completely prevented OAuth
authentication with Google and other providers. Both issues were
discovered during production testing with PhoenixKit v1.4.6.
Modified files:
- lib/phoenix_kit/users/oauth_config.ex
- lib/phoenix_kit/users/oauth.ex
All quality checks passed (mix format, credo, dialyzer, test)
ddon pushed a commit that referenced this pull request Nov 12, 2025
…2MjJ7KaP1osXZbVp8ix
Add GitHub Actions CI pipeline and test infrastructure
@ddonddon mentioned this pull request Apr 16, 2026
mdon added a commit to mdon/phoenix_kit that referenced this pull request May 12, 2026
C12 BeamLabEU#1 agent flagged that the Save / Test Connection / Disconnect /
Delete buttons in `integration_form.html.heex` all lacked the
`phx-disable-with` guard. Playbook calls this out explicitly:
"phx-disable-with on every phx-submit form button AND every
phx-click async/destructive button (delete, restore, refresh,
export, etc.)."
Without it, double-clicks on the Save button can submit two save
requests, the Test Connection button can spawn parallel HTTP probes,
and the destructive buttons (Disconnect / Delete) can fire twice
during the `data-confirm` modal's dismiss window — even though the
modal slows the operator down, a confirm + double-click race is
still reachable. `phx-disable-with` is the load-bearing protection
for async LV operations; `data-confirm` is friendlier UX but not a
substitute.
Added to all four:
* Save — `phx-disable-with={gettext("Saving…")}`
* Test Connection — `phx-disable-with={gettext("Testing…")}`
(alongside the existing `disabled={@testing}` state guard)
* Disconnect — `phx-disable-with={gettext("Disconnecting…")}`
* Delete — `phx-disable-with={gettext("Deleting…")}`
LV form tests (24/24) still pass — none of them double-click these
buttons today, but the regression guard is in place.
ddon pushed a commit that referenced this pull request May 12, 2026
Code (PR #537 review items addressed):
- #1 BUG-MEDIUM: wrap `Annotations.delete/1` in `Repo.transaction/1` so
comment-cascade + annotation-delete are atomic. Extracted into
`delete_in_transaction/1` to keep the body flat (credo depth).
- #2 BUG-MEDIUM: sweep stale `resource_type = "annotation"` claims
across 3 moduledocs (annotation.ex, v115.ex, etcher_adapter.ex). The
implementation anchors comments to the file with
`metadata.annotation_uuid` — docs now match reality.
- #5 BUG-LOW: narrow `delete_linked_comments` rescue to expected
exception classes ([DBConnection.OwnershipError, Postgrex.Error,
ArgumentError]) so logic bugs surface instead of being swallowed.
- #11 IMPROVEMENT-LOW: drop `normalize/1` — `Ecto.Changeset.cast/3`
handles both atom- and string-keyed maps natively; the helper added
silent failure-mode risk on typo'd keys.
- #12 IMPROVEMENT-LOW: drop in-repo `Code.ensure_loaded?(PhoenixKit.Annotations)`
guard in MediaBrowser — Annotations is a core module, can't be
missing.
- #19 NITPICK: drop `PhoenixKit.Modules.Storage` from
AnnotationComposer's `@compile no_warn_undefined` (it's core, not
optional — rename should fail loudly).
- #20 NITPICK: simplify `AnnotationComposerPosition.destroyed` guard.
- #21 NITPICK: fix misleading "Etcher's bootstrap uses `||` to preserve
pre-existing slots" comment — PhoenixKit's JS owns the slots.
- #8 IMPROVEMENT-MEDIUM: gettext-wrap ~17 user-facing strings in
AnnotationComposer (flash messages + heex literals + ARIA labels).
Credo / dialyzer:
- Alias `PhoenixKit.Annotations`, `PhoenixKit.Modules.Storage`,
`PhoenixKit.Modules.Storage.EtcherAdapter`, `Storage.File` so the
six "nested modules could be aliased" findings clear.
- Convert `first_attachment_thumbnail/1`'s single-clause `with` to
`case` (credo readability).
- Add PhoenixKitComments-targeted entries to .dialyzer_ignore.exs for
the annotations context + composer (optional sibling package,
guarded at runtime).
- mix.lock picks up `etcher 0.1.0` via deps.get.
mix precommit: compile → format → credo --strict → dialyzer all clean.
Deferred to original author (Alex): #3 (race), #4 (upload rollback),
#6 (authz), #7 (schema-as-source), #9 (geometry validation), #10
(configurable component id), #13/#14 (locale-aware date + traverse_errors),
plus cosmetics #15-18, #22, #23. Disposition table in CLAUDE_REVIEW.md
updated separately.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ddon pushed a commit that referenced this pull request May 12, 2026
Code (PR #538#1 — carry-over from PR #536 follow-up):
- V114 down SQL: switch the collision-suffix source from
`substring(uuid::text from 1 for 8)` (UUIDv7 timestamp prefix — same
millisecond ⇒ identical prefix ⇒ duplicate suffixed keys when two+
rows collide on (provider, name)) to `substring(uuid::text from 25
for 8)` (the post-variant random tail, 32 bits of entropy ⇒ 1-in-4B
collision probability per pair). Mirrored in `run_down!` in
`v114_test.exs` since the test duplicates the SQL.
- V114 moduledoc updated to spell out the suffix source and why the
timestamp prefix was wrong.
The fix is forward-compat: systems that already ran V114.down get the
old (potentially-collided) keys; fresh installs and any future
rollback get the corrected behavior.
Docs (PR #538#6):
- AGENTS.md TODO entry for `<.draggable_list>` test coverage widened
to call out the new `:sortable_handle` axis: three branches
(`:draggable=false`, `:draggable=true + sortable_handle=nil`,
`:draggable=true + sortable_handle=".pk-drag-handle"`).
Plus a one-line `mix format` normalization in V116 (multi-line
`execute(...)` collapsed to single line).
mix precommit: compile → format → credo --strict (0 findings) →
dialyzer (160 errors all skipped) clean.
Deferred to maintainer: #2 / #3 / #5 (cosmetics on deployed
migrations), #4 (DB-level self-loop CHECK — needs a V117), #7
(`sortable_handle` typo safety — design call on boolean shape vs
JS warning).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ddon pushed a commit that referenced this pull request May 25, 2026
C12 Phase 2 re-validation triage (agent #1, security/async-UX)
flagged the only async-UX gap in this session's new code: the
reorder modal's Apply button submits a phx-event form to the LV
that does a multi-write transaction (write_permutation/2 or
Reorder.reorder/4) — racing double-submits would either deadlock
or double-stamp. phx-disable-with guards both: Phoenix grays the
button + swaps label to 'Applying…' on click and re-enables on
the LV ack.
Strategy radios with required attr block empty submits separately;
the consumer LV's whitelist guard catches forged payloads. This
fix is for the legitimate-but-impatient user.
ddon added a commit that referenced this pull request Jul 14, 2026
…plier-info
V149: catalogue item-supplier sourcing info + CRM xref (for phoenix_kit_catalogue #1)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@timujinne@ddon