271 lines
12 KiB
Plaintext
271 lines
12 KiB
Plaintext
== csoft/lv-demo
|
|
+ assert "password is too short" in errors_on(changeset).password
|
|
+ assert %{password: ["password is too short"]} = errors_on(changeset)
|
|
+ assert {:error, changeset} = Accounts.create_user(%{password: "short"})
|
|
+ # api_key: System.get_env("MAILGUN_API_KEY"),
|
|
+ # All other inputs text, datetime-local, url, password, etc. are handled here...
|
|
+ password: "",
|
|
+ password: "postgres",
|
|
values: ~w(checkbox color date datetime-local email file month number password
|
|
== csoft/continuum-ui
|
|
: this.passwordValidation?.isValid === true
|
|
this.passwordValidation?.isValid === false
|
|
name="password"
|
|
type="password"
|
|
messageText={this.passwordValidation?.message}
|
|
part="password-icon"
|
|
<cu-input name="password" width="w3" label="Пароль" type="password" />
|
|
"type"?: 'text' | 'password' | 'number';
|
|
<cu-input name="field1" width="w3" label="Пароль" type="password" />
|
|
await this.fakeLogin(username, password);
|
|
const isPassword = this.type === 'password';
|
|
const isValid = (auth as any).validateField('password', '');
|
|
const passwordValue = (formData.password as string) || '';
|
|
const { username = '', password = '' } = event.detail.formData as Record<string, string>;
|
|
const { username, password } = event.detail;
|
|
expect(auth.passwordValidation?.message).toBe('Неверный пароль');
|
|
this.passwordValidation = null;
|
|
@Prop() type?: 'text' | 'password' | 'number' = 'text';
|
|
@State() passwordValidation: TFieldValidation | null = null;
|
|
it('validates empty password field', () => {
|
|
private fakeLogin(username: string, password: string): Promise<void> {
|
|
+ : this.passwordValidation?.isValid === true
|
|
+ ? this.passwordValidation.isValid
|
|
+ name="password"
|
|
+ this.passwordValidation?.isValid === false
|
|
+ type="password"
|
|
+ id="password"
|
|
+ name="password"
|
|
+ this.passwordValidation
|
|
+ type="password"
|
|
== admin/lv-demo
|
|
== lv-demo files ==
|
|
.formatter.exs
|
|
.gitignore
|
|
AGENTS.md
|
|
README.md
|
|
assets/css/app.css
|
|
assets/css/fonts/Jaguar-Bold.ttf
|
|
assets/css/fonts/Jaguar-ExtraBold.ttf
|
|
assets/css/fonts/Jaguar-Regular.ttf
|
|
assets/css/fonts/Roboto-Bold.ttf
|
|
assets/css/fonts/Roboto-Bold.woff
|
|
assets/css/fonts/Roboto-Bold.woff2
|
|
assets/css/fonts/Roboto-Medium.ttf
|
|
assets/css/fonts/Roboto-Medium.woff
|
|
assets/css/fonts/Roboto-Medium.woff2
|
|
assets/css/fonts/Roboto-Regular.ttf
|
|
assets/css/fonts/Roboto-Regular.woff
|
|
assets/css/fonts/Roboto-Regular.woff2
|
|
assets/css/fonts/RobotoMono-Bold.ttf
|
|
assets/css/fonts/RobotoMono-Bold.woff
|
|
assets/css/fonts/RobotoMono-Bold.woff2
|
|
assets/css/fonts/RobotoMono-Medium.ttf
|
|
assets/css/fonts/RobotoMono-Medium.woff
|
|
assets/css/fonts/RobotoMono-Medium.woff2
|
|
assets/css/fonts/RobotoMono-Regular.ttf
|
|
assets/css/fonts/RobotoMono-Regular.woff
|
|
assets/css/fonts/RobotoMono-Regular.woff2
|
|
assets/js/app.js
|
|
assets/js/hooks/stencil_bridge.js
|
|
assets/vendor/.DS_Store
|
|
assets/vendor/continuum-ui/dist/cjs/app-globals-3a1e7e63.js
|
|
assets/vendor/continuum-ui/dist/cjs/app-globals-3a1e7e63.js.map
|
|
assets/vendor/continuum-ui/dist/cjs/continuum-ui.cjs.js
|
|
assets/vendor/continuum-ui/dist/cjs/continuum-ui.cjs.js.map
|
|
assets/vendor/continuum-ui/dist/cjs/cu-alert_65.cjs.entry.js
|
|
assets/vendor/continuum-ui/dist/cjs/cu-alert_65.cjs.entry.js.map
|
|
assets/vendor/continuum-ui/dist/cjs/cu-tooltip-7a25a96f.js
|
|
assets/vendor/continuum-ui/dist/cjs/cu-tooltip-7a25a96f.js.map
|
|
assets/vendor/continuum-ui/dist/cjs/index-ef15f796.js
|
|
assets/vendor/continuum-ui/dist/cjs/index-ef15f796.js.map
|
|
assets/vendor/continuum-ui/dist/cjs/index.cjs.js
|
|
assets/vendor/continuum-ui/dist/cjs/index.cjs.js.map
|
|
assets/vendor/continuum-ui/dist/cjs/loader.cjs.js
|
|
assets/vendor/continuum-ui/dist/cjs/loader.cjs.js.map
|
|
assets/vendor/continuum-ui/dist/cjs/main.esm-12a25843.js
|
|
assets/vendor/continuum-ui/dist/cjs/main.esm-12a25843.js.map
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/action_busy.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/action_not_allowed.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/action_poof.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/cell.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/context_menu.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/default.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/hand_grabbing.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/hand_open.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/hand_pointing.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/help.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/make_alias.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/move.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_down.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_east.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_left.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_left_right.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_north.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_north_south.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_northeast.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_northeast_southwest.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_northwest.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_northwest_southeast.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_right.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_south.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_southeast.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_southwest.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_up.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_up_down.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_west.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/resize_west_east.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/text_cursor.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/text_cursor_vertical.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/zoom_in.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/cursors/zoom_out.svg
|
|
assets/vendor/continuum-ui/dist/collection/assets/logo.svg
|
|
== lv-demo runtime ==
|
|
-- config/runtime.exs
|
|
import Config
|
|
|
|
# config/runtime.exs is executed for all environments, including
|
|
# during releases. It is executed after compilation and before the
|
|
# system starts, so it is typically used to load production configuration
|
|
# and secrets from environment variables or elsewhere. Do not define
|
|
# any compile-time configuration in here, as it won't be applied.
|
|
# The block below contains prod specific runtime configuration.
|
|
|
|
# ## Using releases
|
|
#
|
|
# If you use `mix release`, you need to explicitly enable the server
|
|
# by passing the PHX_SERVER=true when you start it:
|
|
#
|
|
# PHX_SERVER=true bin/demo_web start
|
|
#
|
|
# Alternatively, you can use `mix phx.gen.release` to generate a `bin/server`
|
|
# script that automatically sets the env var above.
|
|
if System.get_env("PHX_SERVER") do
|
|
config :demo_web, DemoWebWeb.Endpoint, server: true
|
|
end
|
|
|
|
if config_env() == :prod do
|
|
database_url =
|
|
System.get_env("DATABASE_URL") ||
|
|
raise """
|
|
environment variable DATABASE_URL is missing.
|
|
For example: ecto://USER:PASS@HOST/DATABASE
|
|
"""
|
|
|
|
-- config/prod.exs
|
|
import Config
|
|
|
|
# Note we also include the path to a cache manifest
|
|
# containing the digested version of static files. This
|
|
# manifest is generated by the `mix assets.deploy` task,
|
|
# which you should run after static files are built and
|
|
# before starting your production server.
|
|
config :demo_web, DemoWebWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json"
|
|
|
|
# Configures Swoosh API Client
|
|
config :swoosh, api_client: Swoosh.ApiClient.Req
|
|
|
|
# Disable Swoosh Local Memory Storage
|
|
config :swoosh, local: false
|
|
|
|
# Do not print debug messages in production
|
|
config :logger, level: :info
|
|
|
|
# Runtime production configuration, including reading
|
|
# of environment variables, is done on config/runtime.exs.
|
|
-- config/dev.exs
|
|
import Config
|
|
|
|
# Configure your database
|
|
config :demo_web, DemoWeb.Repo,
|
|
username: "igor",
|
|
password: "",
|
|
hostname: "localhost",
|
|
database: "demo_web_dev",
|
|
stacktrace: true,
|
|
show_sensitive_data_on_connection_error: true,
|
|
pool_size: 10
|
|
|
|
# For development, we disable any cache and enable
|
|
# debugging and code reloading.
|
|
#
|
|
# The watchers configuration can be used to run external
|
|
# watchers to your application. For example, we can use it
|
|
# to bundle .js and .css sources.
|
|
config :demo_web, DemoWebWeb.Endpoint,
|
|
# Binding to loopback ipv4 address prevents access from other machines.
|
|
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
|
|
http: [ip: {127, 0, 0, 1}, port: String.to_integer(System.get_env("PORT") || "4000")],
|
|
check_origin: false,
|
|
code_reloader: true,
|
|
debug_errors: true,
|
|
secret_key_base: "IDMMwnG4qPQsw5FIfOHpLPG/5TY/WVsQmdhFfnSQTYpHusIgFTtKDF/8Wka6T3Xx",
|
|
watchers: [
|
|
esbuild: {Esbuild, :install_and_run, [:demo_web, ~w(--sourcemap=inline --watch)]},
|
|
tailwind: {Tailwind, :install_and_run, [:demo_web, ~w(--watch)]}
|
|
]
|
|
-- config/config.exs
|
|
# This file is responsible for configuring your application
|
|
# and its dependencies with the aid of the Config module.
|
|
#
|
|
# This configuration file is loaded before any dependency and
|
|
# is restricted to this project.
|
|
|
|
# General application configuration
|
|
import Config
|
|
|
|
config :demo_web,
|
|
ecto_repos: [DemoWeb.Repo],
|
|
generators: [timestamp_type: :utc_datetime]
|
|
|
|
# Configures the endpoint
|
|
config :demo_web, DemoWebWeb.Endpoint,
|
|
url: [host: "localhost"],
|
|
adapter: Bandit.PhoenixAdapter,
|
|
render_errors: [
|
|
formats: [html: DemoWebWeb.ErrorHTML, json: DemoWebWeb.ErrorJSON],
|
|
layout: false
|
|
],
|
|
pubsub_server: DemoWeb.PubSub,
|
|
live_view: [signing_salt: "d7USB2Si"]
|
|
|
|
# Configures the mailer
|
|
#
|
|
# By default it uses the "Local" adapter which stores the emails
|
|
# locally. You can see the emails in your browser, at "/dev/mailbox".
|
|
#
|
|
# For production it's recommended to configure a different adapter
|
|
== lv AGENTS ==
|
|
This is a web application written using the Phoenix web framework.
|
|
|
|
## Project guidelines
|
|
|
|
- Use `mix precommit` alias when you are done with all changes and fix any pending issues
|
|
- Use the already included and available `:req` (`Req`) library for HTTP requests, **avoid** `:httpoison`, `:tesla`, and `:httpc`. Req is included by default and is the preferred HTTP client for Phoenix apps
|
|
|
|
### Phoenix v1.8 guidelines
|
|
|
|
- **Always** begin your LiveView templates with `<Layouts.app flash={@flash} ...>` which wraps all inner content
|
|
- The `MyAppWeb.Layouts` module is aliased in the `my_app_web.ex` file, so you can use it without needing to alias it again
|
|
- Anytime you run into errors with no `current_scope` assign:
|
|
- You failed to follow the Authenticated Routes guidelines, or you failed to pass `current_scope` to `<Layouts.app>`
|
|
- **Always** fix the `current_scope` error by moving your routes to the proper `live_session` and ensure you pass `current_scope` as needed
|
|
- Phoenix v1.8 moved the `<.flash_group>` component to the `Layouts` module. You are **forbidden** from calling `<.flash_group>` outside of the `layouts.ex` module
|
|
- Out of the box, `core_components.ex` imports an `<.icon name="hero-x-mark" class="w-5 h-5"/>` component for for hero icons. **Always** use the `<.icon>` component for icons, **never** use `Heroicons` modules or similar
|
|
- **Always** use the imported `<.input>` component for form inputs from `core_components.ex` when available. `<.input>` is imported and using it will will save steps and prevent errors
|
|
- If you override the default input classes (`<.input class="myclass px-2 py-1 rounded-lg">)`) class with your own values, no default classes are inherited, so your
|
|
custom classes must fully style the input
|
|
|
|
### JS and CSS guidelines
|
|
|
|
- **Use Tailwind CSS classes and custom CSS rules** to create polished, responsive, and visually stunning interfaces.
|
|
- Tailwindcss v4 **no longer needs a tailwind.config.js** and uses a new import syntax in `app.css`:
|
|
|
|
@import "tailwindcss" source(none);
|
|
@source "../css";
|
|
@source "../js";
|
|
@source "../../lib/my_app_web";
|
|
|
|
DONE
|
|
[rc=0]
|