Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link panl integration #831

Merged
merged 30 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a3005cf
[Advertisement] Refactor campaign data model #800
mellelieuwes May 2, 2024
9215e4a
Large update of translations after refactor
mellelieuwes May 3, 2024
c39f67f
[Assignment] implement questionnaire template #804
mellelieuwes May 4, 2024
dce5f92
Refactor to 100% support Fabric + added Advert creation from Advertis…
mellelieuwes May 17, 2024
0f69e9d
Added Advert CMS + Project Card
mellelieuwes May 27, 2024
3cfa78d
#818 [Advert] Add firing of monitor events
mellelieuwes May 27, 2024
9134082
Fixed hero image dimension (banner vs large)
mellelieuwes May 27, 2024
b6db6c1
Moved core/lib Accounts code to core/systems/account
mellelieuwes May 29, 2024
479e681
[Account] Add verified concept #823
mellelieuwes May 30, 2024
9218045
[Account] Participant + Creator signin/signup #824
mellelieuwes May 31, 2024
92e34ff
[Advert] Add participant to pool #819
mellelieuwes Jun 2, 2024
c476c46
[Home] Add section of citizen pools #820
mellelieuwes Jun 5, 2024
5e06cca
first round of bugfixes
mellelieuwes Jun 5, 2024
395a60d
Fixed default assignment name
mellelieuwes Jun 5, 2024
f9cbab9
#834 Unable to logon with creator test account after verification
mellelieuwes Jun 6, 2024
3996677
added some debug
mellelieuwes Jun 6, 2024
9603965
#835 if creator filter is selected then verified filter does not work
mellelieuwes Jun 6, 2024
ea0bc7b
#832 uploading zip for benchmark (upload failed)
mellelieuwes Jun 6, 2024
f5205e0
fixed bug with order of dynamically stacked fabric childs
mellelieuwes Jun 6, 2024
9612d02
#838 Add participant instructions - internal server error
mellelieuwes Jun 7, 2024
dd5ea0f
#836 My profile - edits not saved
mellelieuwes Jun 7, 2024
5bd89a8
#841 As admin searching for users does not work
mellelieuwes Jun 7, 2024
2547900
#842 Deleting a project shows a strangely transparent message
mellelieuwes Jun 7, 2024
dcc42a8
#839 Change in verified status for creator requires logout and login
mellelieuwes Jun 7, 2024
75fc5c5
#837 Desktop - Internal server error
mellelieuwes Jun 7, 2024
8caa8b8
#834 Clicking on a leaderboard results in Internal Server Error 500
mellelieuwes Jun 7, 2024
2e300c5
#849 User search only returns one result
mellelieuwes Jun 10, 2024
b58548c
#847 Error text instead of search button
mellelieuwes Jun 10, 2024
1ed6946
#844 prevent passwordhashes from being logged
mellelieuwes Jun 10, 2024
3823dae
#846 PANL Consent text of fresh test project 'has already been signed'
mellelieuwes Jun 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ logfile
/mix_home/
/core/config/dev.secret.exs
/core/docker.env
/core/playground.exs
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ repos:
hooks:
- id: trailing-whitespace
- id: check-added-large-files
exclude: "core/priv/static/landing_page/img/uu.svg"
- id: check-merge-conflict
- id: no-commit-to-branch
args: [-b, master]
Expand Down
11 changes: 10 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,14 @@
},
"css.validate": false,
"less.validate": false,
"scss.validate": false
"scss.validate": false,
"elixirLS.projectDir": "core",
"emmet.includeLanguages": {
"phoenix-heex": "html"
},
"tailwindCSS.includeLanguages": {
"elixir": "html",
"phoenix-heex": "html"
},
"editor.tabCompletion": "on"
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Project implementing a SaaS platform based on interlinked modules called Systems
* Banking
* Bookkeeping
* Budget
* Campaign
* Advert
* Assignment
* Lab
* Questionnaire
Expand Down
9 changes: 1 addition & 8 deletions core/.dialyzer_ignore.exs
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
[
# https://github.com/phoenixframework/phoenix/issues/5437, fixed in Phoenix 1.7.3 or higher
{"systems/benchmark/export_controller.ex", :no_return},
{"systems/benchmark/export_controller.ex", :call},
# issue with HTTPPoison not supporting HTTP method :mkcol
{"systems/storage/yoda/client.ex", :no_return},
{"systems/storage/yoda/client.ex", :call},
# Deprecated fiunction raises exception
{"systems/assignment/_director.ex", :no_return},
{"systems/assignment/_private.ex", :no_return},
{"systems/campaign/builders/promotion_landing_page.ex", :no_return}
{"systems/benchmark/export_controller.ex", :call}
]
16 changes: 8 additions & 8 deletions core/assets/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,18 @@ module.exports = {
"platform-footer": "62px",
"footer-sm": "64px",
"footer-lg": "96px",
header1: "100px",
"header1-sm": "170px",
"header1-lg": "370px",
header2: "100px",
"header2-sm": "100px",
"header2-lg": "183px",
hero1: "100px",
"hero1-sm": "170px",
"hero1-lg": "360px",
hero2: "100px",
"hero2-sm": "100px",
"hero2-lg": "183px",
logo: "32px",
"logo-sm": "48px",
"lab-day-popup-list": "392px",
"image-header": "375px",
"image-header-sm": "500px",
"image-card": "200px",
"image-card": "212px",
"image-preview": "90px",
"image-preview-sm": "150px",
"image-preview-circle": "120px",
Expand Down Expand Up @@ -249,7 +249,7 @@ module.exports = {
},
maxHeight: {
dropdown: "317px",
header1: "376px",
hero1: "376px",
form: "400px",
mailto: "128px",
"wysiwyg-editor": "960px",
Expand Down
23 changes: 6 additions & 17 deletions core/bundles/next/bundle.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,17 @@ defmodule Next.Bundle do
def routes do
if include?() do
quote do
scope "/", Next do
pipe_through([:browser])
get("/", Home.LandingPageController, :show)
end

scope "/", Next do
pipe_through([:browser, :redirect_if_user_is_authenticated])
live("/user/signin", User.Signin)
get("/user/session", User.SessionController, :new)
post("/user/session", User.SessionController, :create)
live("/user/signin", Account.SigninPage)
live("/user/signin/:user_type", Account.SigninPage)
get("/user/session", Account.SessionController, :new)
post("/user/session", Account.SessionController, :create)
end

scope "/", Next do
pipe_through([:browser])
delete("/user/session", User.SessionController, :delete)
end

scope "/", Next do
pipe_through([:browser, :require_authenticated_user])
live("/console", Console.Page)
live("/next", Console.Page)
delete("/user/session", Account.SessionController, :delete)
end
end
end
Expand All @@ -35,8 +25,7 @@ defmodule Next.Bundle do
def grants do
if include?() do
quote do
grant_access(Next.Console.Page, [:member])
grant_access(Next.User.Signin, [:visitor, :member])
grant_access(Next.Account.SigninPage, [:visitor, :member])
end
end
end
Expand Down
9 changes: 5 additions & 4 deletions core/bundles/next/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ config :core,
website_menu_builder: Next.Layouts.Website.MenuBuilder,
stripped_menu_builder: Next.Layouts.Stripped.MenuBuilder

config :core, CoreWeb.UserAuth,
researcher_signed_in_page: "/project",
participant_signed_in_page: "/project"
config :core, Systems.Account.UserAuth,
creator_signed_in_page: "/project",
member_signed_in_page: "/"

config :core, :features,
sign_in_with_apple: false,
member_google_sign_in: false,
surfconext_sign_in: true,
member_google_sign_in: true,
password_sign_in: true,
notification_mails: false,
debug_expire_force: false,
Expand Down
51 changes: 51 additions & 0 deletions core/bundles/next/lib/account/creator_signin_view.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
defmodule Next.Account.CreatorSigninView do
use CoreWeb, :live_component

import Frameworks.Pixel.Line
import Systems.Account.UserForm
alias Systems.Account.User

@impl true
def update(%{blocks: blocks, email: email}, socket) do
{
:ok,
socket
|> assign(blocks: blocks, email: email)
|> update_password_form()
}
end

defp update_password_form(%{assigns: %{email: email}} = socket) do
attrs =
if User.valid_email?(email) do
%{"email" => email}
else
%{}
end

assign(socket, :password_form, to_form(attrs))
end

@impl true
def render(assigns) do
~H"""
<div>
<%= for block <- @blocks do %>
<%= if block == :surfconext do %>
<Text.body_small><%= raw(dgettext("eyra-next", "surfconext.signin.body")) %></Text.body_small>
<.spacing value="XS" />
<.surfconext_signin />
<% end %>
<%= if block == :password do %>
<.password_signin for={@password_form} user_type={:creator}/>
<% end %>
<%= if block == :seperator do %>
<.spacing value="S" />
<.line />
<.spacing value="M" />
<% end %>
<% end %>
</div>
"""
end
end
50 changes: 50 additions & 0 deletions core/bundles/next/lib/account/participant_signin_view.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
defmodule Next.Account.ParticipantSigninView do
use CoreWeb, :live_component

import Frameworks.Pixel.Line
import Systems.Account.UserForm

alias Systems.Account.User

@impl true
def update(%{blocks: blocks, email: email}, socket) do
{
:ok,
socket
|> assign(email: email, blocks: blocks)
|> update_password_form()
}
end

defp update_password_form(%{assigns: %{email: email}} = socket) do
attrs =
if User.valid_email?(email) do
%{"email" => email}
else
%{}
end

assign(socket, :password_form, to_form(attrs))
end

@impl true
def render(assigns) do
~H"""
<div>
<%= for block <- @blocks do %>
<%= if block == :google do %>
<.google_signin />
<% end %>
<%= if block == :password do %>
<.password_signin for={@password_form} user_type={:participant}/>
<% end %>
<%= if block == :seperator do %>
<.spacing value="S" />
<.line />
<.spacing value="M" />
<% end %>
<% end %>
</div>
"""
end
end
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
defmodule Next.User.SessionController do
defmodule Next.Account.SessionController do
use CoreWeb, :controller
import CoreWeb.Gettext

alias Systems.Account

plug(:setup_sign_in_with_apple, :core when action != :delete)

defp setup_sign_in_with_apple(conn, otp_app) do
Expand Down Expand Up @@ -29,8 +31,8 @@ defmodule Next.User.SessionController do
def create(conn, %{"email" => email, "password" => password} = user_params) do
require_feature(:password_sign_in)

if user = Core.Accounts.get_user_by_email_and_password(email, password) do
CoreWeb.UserAuth.log_in_user(conn, user, false, user_params)
if user = Account.Public.get_user_by_email_and_password(email, password) do
Account.UserAuth.log_in_user(conn, user, false, user_params)
else
message = dgettext("eyra-user", "Invalid email or password")

Expand All @@ -47,6 +49,6 @@ defmodule Next.User.SessionController do
def delete(conn, _params) do
conn
|> put_flash(:info, dgettext("eyra-user", "Signed out successfully"))
|> CoreWeb.UserAuth.log_out_user()
|> Account.UserAuth.log_out_user()
end
end
58 changes: 58 additions & 0 deletions core/bundles/next/lib/account/signin_page.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
defmodule Next.Account.SigninPage do
use CoreWeb, :live_view
import CoreWeb.Layouts.Stripped.Html
import CoreWeb.Layouts.Stripped.Composer
import Frameworks.Pixel.Line

alias Frameworks.Pixel.Tabbar

alias Next.Account.SigninPageBuilder

@impl true
def mount(params, _session, socket) do
user_type = Map.get(params, "user_type", "participant")
initial_tab = Map.get(params, "tab", user_type)
tabbar_id = "account_signin"

{
:ok,
socket
|> assign(
email: Map.get(params, "email"),
user_type: user_type,
initial_tab: initial_tab,
tabbar_id: tabbar_id,
show_errors: true
)
|> update_view_model()
|> update_menus()
}
end

defp update_view_model(socket) do
vm = SigninPageBuilder.view_model(nil, socket.assigns)
assign(socket, vm: vm)
end

@impl true
def render(assigns) do
~H"""
<.stripped menus={@menus}>
<div id="signup_content" phx-hook="LiveContent" data-show-errors={true}>
<Area.form>
<Margin.y id={:page_top} />
<Margin.y id={:page_top} />
<Text.title2><%= dgettext("eyra-account", "signin.title") %></Text.title2>
<Tabbar.container id={@tabbar_id} tabs={@vm.tabs} initial_tab={@initial_tab} type={:segmented} size={:full} />
<.spacing value="M" />
<.line />
<.spacing value="M" />
<div id="tabbar_content" phx-hook="LiveContent" data-show-errors={@show_errors}>
<Tabbar.content include_top_margin={false} tabs={@vm.tabs} />
</div>
</Area.form>
</div>
</.stripped>
"""
end
end
Loading
Loading