Skip to content

Commit

Permalink
Fix admin user creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ukutaht committed Jan 14, 2021
1 parent bf4a81b commit 8aa697f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Changelog
All notable changes to this project will be documented in this file.

## [1.1.2] - Unreleased
## [1.2] - Unreleased

### Added
- Ability to add event metadata plausible/analytics#381
Expand All @@ -25,6 +25,8 @@ All notable changes to this project will be documented in this file.
- Improve onboarding UX and design plausible/analytics#441
- Allows outbound link tracking script to use new tab redirection plausible/analytics#494
- "This Month" view is now Month-to-date for the current month plausible/analytics#491
- Background jobs are enabled by default for self-hosted installations plausible/analytics#603
- All new users on self-hosted installations have a never-ending trial plausible/analytics#603

### Fixed
- Do not error when activating an already activated account plausible/analytics#370
Expand Down
4 changes: 2 additions & 2 deletions lib/plausible/auth/auth.ex
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ defmodule Plausible.Auth do
end
end

def create_user(name, email) do
def create_user(name, email, pwd) do
%Auth.User{}
|> Auth.User.new(%{name: name, email: email})
|> Auth.User.new(%{name: name, email: email, password: pwd, password_confirmation: pwd})
|> Repo.insert()
end

Expand Down
5 changes: 1 addition & 4 deletions lib/plausible_release.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ defmodule Plausible.Release do

case Plausible.Auth.find_user_by(email: admin_email) do
nil ->
{:ok, admin} = Plausible.Auth.create_user(admin_user, admin_email)
# set the password
{:ok, _} = Plausible.Auth.User.set_password(admin, admin_pwd) |> Repo.update()

{:ok, _} = Plausible.Auth.create_user(admin_user, admin_email, admin_pwd)
IO.puts("Admin user created successful!")

_ ->
Expand Down

0 comments on commit 8aa697f

Please sign in to comment.