Revamp the UI on Login / Register page (#2919)

This commit is contained in:
Tiago Vasconcelos 2025-02-07 07:43:19 +00:00 committed by GitHub
parent 736699af94
commit 9a1d707f54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 1125 additions and 667 deletions

View file

@ -74,8 +74,8 @@
></q-input>
</div>
</div>
<div class="row q-col-gutter-md">
<div class="col-12 col-md-4">
<div class="row q-col-gutter-md q-mt-md">
<div class="col-12 col-md-6">
<p><span v-text="$t('ui_custom_badge')"></span></p>
<div class="row q-col-gutter-md">
<div class="col-12 col-md-8">
@ -97,6 +97,17 @@
</div>
</div>
</div>
<div class="col-12 col-md-6">
<p><span v-text="$t('ui_custom_image')"></span></p>
<q-input
filled
type="text"
tip="Custom Image"
v-model.trim="formData.lnbits_custom_image"
:label="$t('ui_custom_image_label')"
:hint="$t('ui_custom_image_hint')"
></q-input>
</div>
</div>
<br />
<div class="row q-col-gutter-md">

View file

@ -1,31 +1,107 @@
{% extends "public.html" %} {% block scripts %}
<style>
:root {
--size: 100px;
--gap: 25px;
}
.btn-fixed-width {
/* width: 45%; */
}
.wrapper {
display: flex;
flex-direction: column;
gap: var(--gap);
margin: auto;
max-width: 100%;
}
.marquee {
display: flex;
overflow: hidden;
user-select: none;
gap: var(--gap);
height: max-content;
mask-image: linear-gradient(
to right,
hsl(0 0% 0% / 0),
hsl(0 0% 0% / 1) 20%,
hsl(0 0% 0% / 1) 80%,
hsl(0 0% 0% / 0)
);
}
.marquee__group {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: space-around;
gap: var(--gap);
min-width: 100%;
animation: scroll-x 60s linear infinite;
}
.marquee:hover .marquee__group {
animation-play-state: paused;
}
.marquee__group div {
width: var(--size);
}
@keyframes scroll-x {
from {
transform: translateX(0);
}
to {
transform: translateX(calc(-100% - var(--gap)));
}
}
</style>
<script src="{{ static_url_for('static', 'js/index.js') }}"></script>
{% endblock %} {% block page_container %}
<div class="row q-col-gutter-md justify-center">
<q-page-container>
<q-page
class="q-px-md q-py-lg content-center"
:class="{'q-px-lg': $q.screen.gt.xs}"
>
{% block page %}
<div
v-if="isUserAuthorized"
class="col-12 col-md-6 col-lg-6 q-gutter-y-md"
></div>
<div v-else class="col-12 col-md-4 col-lg-4 q-gutter-y-md">
<div class="gt-sm">
<h3
class="row justify-center items-center"
style="min-height: calc(100vh / 1.618)"
>
<div
class="full-width"
:style="`max-width: ${'{{ LNBITS_CUSTOM_IMAGE }}' ? '850' : '600'}px`"
>
<div class="row q-mb-md">
<div class="col-12">
<div>
<h5
class="q-my-none"
v-if="'{{LNBITS_SHOW_HOME_PAGE_ELEMENTS}}' == 'True'"
>
{{SITE_TITLE}}
</h3>
<h5 class="q-my-md" v-if="'{{LNBITS_SHOW_HOME_PAGE_ELEMENTS}}' == 'True'">
{{SITE_TAGLINE}}
</h5>
<div
<h6
class="q-my-sm"
v-if="'{{LNBITS_SHOW_HOME_PAGE_ELEMENTS}}' == 'True'"
>
{{SITE_TAGLINE}}
</h6>
<!-- <div
class="gt-sm"
v-html="formatDescription"
v-if="'{{LNBITS_SHOW_HOME_PAGE_ELEMENTS}}' == 'True'"
></div>
></div> -->
</div>
</div>
</div>
{% if lnurl and LNBITS_NEW_ACCOUNTS_ALLOWED and ("user-id-only" in
LNBITS_AUTH_METHODS)%}
<div class="row q-mt-xl">
<div class="col-12 col-md-8 col-lg-7 q-gutter-y-md">
<div class="row">
<div class="full-width q-mb-md">
<q-card>
<q-card-section>
<q-btn
@ -42,350 +118,92 @@
</div>
</div>
{%else%} {% endif %}
<div class="row q-mt-md">
<div class="col-12 col-md-10 col-lg-10 q-gutter-y-md">
<q-badge v-if="isAccessTokenExpired" color="primary" rounded>
<div class="text-h5">
<div class="row">
<q-badge
v-if="isAccessTokenExpired"
class="q-mx-auto q-mb-md"
color="primary"
rounded
>
<div class="text-h6">
<span v-text="$t('session_has_expired')"></span>
</div>
</q-badge>
<q-card class="shadow-12">
{% if "user-id-only" in LNBITS_AUTH_METHODS %}
<q-card-section>
<div class="text-h6">
<span v-text="$t('instant_access_question')"></span>
<br />
<q-badge
@click="showLogin('user-id-only')"
color="primary"
class="cursor-pointer"
rounded
<q-card bordered class="full-width q-pt-md">
<div class="row">
<div
class="col-12"
:class="{'col-sm-7' : '{{ LNBITS_CUSTOM_IMAGE }}', 'col-lg-6' : '{{ LNBITS_CUSTOM_IMAGE }}'}"
>
<strong>
<q-icon name="account_circle" size="xs"></q-icon>
<span v-text="$t('login_with_user_id')"></span> </strong
></q-badge>
{% if LNBITS_NEW_ACCOUNTS_ALLOWED %}
<span v-text="$t('or')"></span>
<q-badge
@click="showRegister('user-id-only')"
color="primary"
class="cursor-pointer"
rounded
>
<strong>
<q-icon name="add" size="xs"></q-icon>
<span v-text="$t('create_new_wallet')"></span>
</strong>
</q-badge>
{%endif%}
</div>
</q-card-section>
<q-separator></q-separator>
<q-card-section
v-if="authAction === 'login' && authMethod === 'user-id-only'"
>
<b> <span v-text="$t('login_with_user_id')"></span> </b><br /><br />
<q-form @submit="loginUsr" class="q-gutter-md">
<q-input
filled
dense
v-model="usr"
label="usr"
type="password"
></q-input>
<div>
<q-btn
unelevated
color="primary"
:disable="usr == ''"
type="submit"
label="Login"
class="full-width"
></q-btn>
</div>
</q-form>
</q-card-section>
{%endif%} {% if "username-password" in LNBITS_AUTH_METHODS %}
<q-card-section
v-if="authAction === 'login' && authMethod === 'username-password'"
>
<div class="q-mb-lg">
<strong>
<span v-text="$t('login_to_account')"></span>
</strong>
</div>
<q-form @submit="login" class="q-gutter-md">
<q-input
filled
dense
v-model="username"
name="username"
:label="$t('username_or_email') + ' *'"
></q-input>
<q-input
filled
dense
v-model="password"
name="password"
:label="$t('password') + ' *'"
type="password"
></q-input>
<div>
<q-btn
:disable="!username || !password"
color="primary"
type="submit"
:label="$t('login')"
class="full-width"
></q-btn>
</div>
</q-form>
</q-card-section>
<q-card-section
v-if="authAction === 'register' && authMethod === 'username-password'"
>
<b> <span v-text="$t('create_account')"></span> </b><br /><br />
<q-form @submit="register" class="q-gutter-md">
<q-input
filled
dense
required
v-model="username"
:label="$t('username') + ' *'"
:rules="[(val) => validateUsername(val) || $t('invalid_username')]"
></q-input>
<q-input
filled
dense
v-model="password"
:label="$t('password') + ' *'"
type="password"
:rules="[(val) => !val || val.length >= 8 || $t('invalid_password')]"
></q-input>
<q-input
filled
dense
v-model="passwordRepeat"
:label="$t('password_repeat') + ' *'"
type="password"
:rules="[(val) => !val || val.length >= 8 || $t('invalid_password')]"
></q-input>
<div>
<q-btn
unelevated
color="primary"
:disable="!password || !passwordRepeat|| !username || (password !== passwordRepeat)"
type="submit"
class="full-width"
:label="$t('create_account')"
></q-btn>
</div>
</q-form>
</q-card-section>
<q-card-section
v-if="authAction === 'reset' && authMethod === 'username-password'"
>
<b> <span v-text="$t('reset_password')"></span> </b><br /><br />
<q-form @submit="reset" class="q-gutter-md">
<q-input
filled
dense
required
:disable="true"
v-model="reset_key"
:label="$t('reset_key') + ' *'"
></q-input>
<q-input
filled
dense
v-model="password"
:label="$t('password') + ' *'"
type="password"
:rules="[(val) => !val || val.length >= 8 || $t('invalid_password')]"
></q-input>
<q-input
filled
dense
v-model="passwordRepeat"
:label="$t('password_repeat') + ' *'"
type="password"
:rules="[(val) => !val || val.length >= 8 || $t('invalid_password')]"
></q-input>
<div>
<q-btn
unelevated
color="primary"
:disable="!password || !passwordRepeat|| !reset_key || (password !== passwordRepeat)"
type="submit"
class="full-width"
:label="$t('reset_password')"
></q-btn>
</div>
</q-form>
</q-card-section>
{%endif%} {% if LNBITS_NEW_ACCOUNTS_ALLOWED %}
<q-card-section
v-if="authAction === 'register' && authMethod === 'user-id-only'"
>
<div>
<q-form @submit="createWallet" class="q-gutter-md">
<q-input
filled
dense
v-model="walletName"
:label='$t("name_your_wallet", { name: "{{ SITE_TITLE }} *" })'
></q-input>
<div>
<q-btn
color="primary"
:disable="walletName == ''"
type="submit"
:label="$t('add_wallet')"
class="full-width"
></q-btn>
</div>
</q-form>
</div>
</q-card-section>
{% if "username-password" in LNBITS_AUTH_METHODS %}
<q-card-section
v-if="authAction === 'login' && authMethod === 'username-password'"
<username-password
v-if="authMethod != 'user-id-only'"
:allowed_new_users="{{ LNBITS_NEW_ACCOUNTS_ALLOWED | tojson }}"
:auth-methods="{{ LNBITS_AUTH_METHODS }}"
:auth-action="authAction"
v-model:user-name="username"
v-model:password_1="password"
v-model:password_2="passwordRepeat"
v-model:reset-key="reset_key"
@login="login"
@register="register"
@reset="reset"
>
<div>
<q-btn
color="grey"
outline
:label="$t('register')"
class="full-width"
<div
class="text-center text-grey-6"
v-if="authAction !== 'reset'"
>
<p v-if="authAction === 'login'" class="q-mb-none">
Not registered? Create an
<span
class="text-secondary cursor-pointer"
@click="showRegister('username-password')"
></q-btn>
</div>
</q-card-section>
{%endif%}
<q-separator></q-separator>
{% endif %}
<q-card-section
v-if="authAction === 'login' && authMethod === 'username-password'"
>Account</span
>
<div class="row">
{% if "nostr-auth-nip98" in LNBITS_AUTH_METHODS %}
<div class="col-12 full-width q-pa-sm">
<q-btn
@click="signInWithNostr"
outline
no-caps
rounded
color="grey"
class="full-width"
>
<q-avatar size="32px" class="q-mr-md">
<q-img
class="bg-primary"
:src="'{{ static_url_for('static', 'images/logos/nostr.svg') }}'"
></q-img>
</q-avatar>
<div>
<span v-text="$t('signin_with_nostr')"></span>
</div>
</q-btn>
</div>
{%endif%} {% if "google-auth" in LNBITS_AUTH_METHODS %}
<div class="col-12 full-width q-pa-sm">
<q-btn
href="/api/v1/auth/google"
type="a"
outline
no-caps
rounded
color="grey"
class="full-width"
>
<q-avatar size="32px" class="q-mr-md">
<q-img
:src="'{{ static_url_for('static', 'images/google-logo.png') }}'"
></q-img>
</q-avatar>
<div>
<span v-text="$t('signin_with_google')"></span>
</div>
</q-btn>
</div>
{%endif%} {% if "github-auth" in LNBITS_AUTH_METHODS %}
<div class="col-12 full-width q-pa-sm">
<q-btn
href="/api/v1/auth/github"
type="a"
outline
no-caps
color="grey"
rounded
class="full-width"
>
<q-avatar size="32px" class="q-mr-md">
<q-img
:src="'{{ static_url_for('static', 'images/github-logo.png') }}'"
></q-img>
</q-avatar>
<div><span v-text="$t('signin_with_github')"></span></div>
</q-btn>
</div>
{%endif%} {% if "keycloak-auth" in LNBITS_AUTH_METHODS %}
<div class="col-12 full-width q-pa-sm">
<q-btn
href="/api/v1/auth/keycloak"
type="a"
outline
no-caps
color="grey"
rounded
class="full-width"
>
<q-avatar size="32px" class="q-mr-md">
<q-img
:src="'{{ static_url_for('static', 'images/keycloak-logo.png') }}'"
></q-img>
</q-avatar>
<div><span v-text="$t('signin_with_keycloak')"></span></div>
</q-btn>
</div>
{%endif%}
</div>
</q-card-section>
<q-card-section v-else>
<div class="row">
<div class="col q-pa-sm">
<q-btn
</p>
<p v-else class="q-mb-none">
Aready have an account?
<span
class="text-secondary cursor-pointer"
@click="showLogin('username-password')"
:label="$t('back')"
outline
rounded
color="grey"
class="full-width"
>Login</span
>
</q-btn>
</p>
</div>
</username-password>
{%endif%} {% if "user-id-only" in LNBITS_AUTH_METHODS %}
<user-id-only
:allowed_new_users="{{ LNBITS_NEW_ACCOUNTS_ALLOWED | tojson }}"
v-model:usr="usr"
v-model:wallet="walletName"
:auth-action="authAction"
:auth-method="authMethod"
@show-login="showLogin"
@show-register="showRegister"
@login-usr="loginUsr"
@create-wallet="createWallet"
>
</user-id-only>
{%endif%}
</div>
<div
class="col-sm-5 col-lg-6 gt-xs"
v-if="'{{ LNBITS_CUSTOM_IMAGE }}'"
>
<div class="full-height flex flex-center q-pa-lg">
<q-img
:src="'{{ LNBITS_CUSTOM_IMAGE }}'"
:ratio="1"
width="250px"
></q-img>
</div>
</div>
</div>
</q-card-section>
</q-card>
</div>
</div>
</div>
<div
v-if="'{{LNBITS_SHOW_HOME_PAGE_ELEMENTS}}' == 'False'"
class="col-12 col-md-5 col-lg-5 q-pt-xl"
>
<h3 class="q-my-none">{{SITE_TITLE}}</h3>
<h5 class="q-my-md">{{SITE_TAGLINE}}</h5>
<div v-html="formatDescription"></div>
</div>
<div class="col-12 col-md-3 col-lg-3 gt-sm" v-else>
<div class="row q-col-gutter-lg justify-center">
<div class="col-6 col-sm-4 col-md-8 q-gutter-y-sm">
<div class="full-width q-mb-xl q-mt-sm">
<div class="flex flex-center q-gutter-md q-py-md">
<q-btn
outline
color="grey"
@ -394,7 +212,7 @@
target="_blank"
rel="noopener noreferrer"
:label="$t('view_github')"
class="full-width"
class=""
></q-btn>
<q-btn
outline
@ -404,18 +222,15 @@
target="_blank"
rel="noopener noreferrer"
:label="$t('donate')"
class="full-width q-mb-lg"
class=""
></q-btn>
</div>
<div class="col-6 col-sm-4 col-md-8 q-gutter-y-sm">
<q-btn
flat
color="secondary"
:label="$t('runs_on')"
class="full-width"
></q-btn>
<div class="row">
<div class="col">
</div>
<div class="full-width">
<div class="wrapper">
<div class="marquee">
<div class="marquee__group">
<div>
<a
href="https://github.com/ElementsProject/lightning"
target="_blank"
@ -427,7 +242,7 @@
></q-img>
</a>
</div>
<div class="col q-pl-md">
<div>
<a
href="https://github.com/lightningnetwork/lnd"
target="_blank"
@ -439,10 +254,7 @@
></q-img>
</a>
</div>
</div>
<div class="row">
<div class="col">
<div>
<a
href="https://opennode.com"
target="_blank"
@ -454,7 +266,7 @@
></q-img>
</a>
</div>
<div class="col q-pl-md">
<div>
<a
href="https://lnpay.co/"
target="_blank"
@ -466,10 +278,7 @@
></q-img>
</a>
</div>
</div>
<div class="row">
<div class="col">
<div>
<a
href="https://github.com/rootzoll/raspiblitz"
target="_blank"
@ -481,7 +290,7 @@
></q-img>
</a>
</div>
<div class="col q-pl-md">
<div>
<a
href="https://start9.com/"
target="_blank"
@ -493,9 +302,7 @@
></q-img>
</a>
</div>
</div>
<div class="row">
<div class="col">
<div>
<a
href="https://getumbrel.com/"
target="_blank"
@ -507,7 +314,7 @@
></q-img>
</a>
</div>
<div class="col q-pl-md">
<div>
<a
href="https://mynodebtc.com"
target="_blank"
@ -519,9 +326,7 @@
></q-img>
</a>
</div>
</div>
<div class="row">
<div class="col">
<div>
<a
href="https://github.com/shesek/spark-wallet"
target="_blank"
@ -533,7 +338,7 @@
></q-img>
</a>
</div>
<div class="col q-pl-md">
<div>
<a
href="https://voltage.cloud"
target="_blank"
@ -545,9 +350,7 @@
></q-img>
</a>
</div>
</div>
<div class="row">
<div class="col">
<div>
<a
href="https://breez.technology/sdk/"
target="_blank"
@ -559,7 +362,7 @@
></q-img>
</a>
</div>
<div class="col q-pl-md">
<div>
<a
href="https://blockstream.com/lightning/greenlight/"
target="_blank"
@ -571,9 +374,7 @@
></q-img>
</a>
</div>
</div>
<div class="row">
<div class="col">
<div>
<a
href="https://getalby.com"
target="_blank"
@ -585,17 +386,19 @@
></q-img>
</a>
</div>
<div class="col q-pl-md">
<a href="https://zbd.gg" target="_blank" rel="noopener noreferrer">
<div>
<a
href="https://zbd.gg"
target="_blank"
rel="noopener noreferrer"
>
<q-img
contain
:src="($q.dark.isActive) ? '{{ static_url_for('static', 'images/zbd.png') }}' : '{{ static_url_for('static', 'images/zbdl.png') }}'"
></q-img>
</a>
</div>
</div>
<div class="row">
<div class="col">
<div>
<a
href="https://phoenix.acinq.co/server"
target="_blank"
@ -607,7 +410,7 @@
></q-img>
</a>
</div>
<div class="col">
<div>
<a
href="https://boltz.exchange/"
target="_blank"
@ -619,41 +422,236 @@
></q-img>
</a>
</div>
<!-- # -->
</div>
</div>
</div>
</div>
</div>
{% if AD_SPACE %}
<div class="row justify-center">
<q-btn flat color="secondary" class="full-width q-mb-md"
>{{ AD_SPACE_TITLE }}</q-btn
<div class="marquee__group">
<div>
<a
href="https://github.com/ElementsProject/lightning"
target="_blank"
rel="noopener noreferrer"
>
<q-img
contain
:src="($q.dark.isActive) ? '{{ static_url_for('static', 'images/cln.png') }}' : '{{ static_url_for('static', 'images/clnl.png') }}'"
></q-img>
</a>
</div>
<div>
<a
href="https://github.com/lightningnetwork/lnd"
target="_blank"
rel="noopener noreferrer"
>
<q-img
contain
:src="($q.dark.isActive) ? '{{ static_url_for('static', 'images/lnd.png') }}' : '{{ static_url_for('static', 'images/lnd.png') }}'"
></q-img>
</a>
</div>
<div>
<a
href="https://opennode.com"
target="_blank"
rel="noopener noreferrer"
>
<q-img
contain
:src="($q.dark.isActive) ? '{{ static_url_for('static', 'images/opennode.png') }}' : '{{ static_url_for('static', 'images/opennodel.png') }}'"
></q-img>
</a>
</div>
<div>
<a
href="https://lnpay.co/"
target="_blank"
rel="noopener noreferrer"
>
<q-img
contain
:src="($q.dark.isActive) ? '{{ static_url_for('static', 'images/lnpay.png') }}' : '{{ static_url_for('static', 'images/lnpayl.png') }}'"
></q-img>
</a>
</div>
<div>
<a
href="https://github.com/rootzoll/raspiblitz"
target="_blank"
rel="noopener noreferrer"
>
<q-img
contain
:src="($q.dark.isActive) ? '{{ static_url_for('static', 'images/blitz.png') }}' : '{{ static_url_for('static', 'images/blitzl.png') }}'"
></q-img>
</a>
</div>
<div>
<a
href="https://start9.com/"
target="_blank"
rel="noopener noreferrer"
>
<q-img
contain
:src="($q.dark.isActive) ? '{{ static_url_for('static', 'images/start9.png') }}' : '{{ static_url_for('static', 'images/start9l.png') }}'"
></q-img>
</a>
</div>
<div>
<a
href="https://getumbrel.com/"
target="_blank"
rel="noopener noreferrer"
>
<q-img
contain
:src="($q.dark.isActive) ? '{{ static_url_for('static', 'images/umbrel.png') }}' : '{{ static_url_for('static', 'images/umbrell.png') }}'"
></q-img>
</a>
</div>
<div>
<a
href="https://mynodebtc.com"
target="_blank"
rel="noopener noreferrer"
>
<q-img
contain
:src="($q.dark.isActive) ? '{{ static_url_for('static', 'images/mynode.png') }}' : '{{ static_url_for('static', 'images/mynodel.png') }}'"
></q-img>
</a>
</div>
<div>
<a
href="https://github.com/shesek/spark-wallet"
target="_blank"
rel="noopener noreferrer"
>
<q-img
contain
:src="($q.dark.isActive) ? '{{ static_url_for('static', 'images/spark.png') }}' : '{{ static_url_for('static', 'images/sparkl.png') }}'"
></q-img>
</a>
</div>
<div>
<a
href="https://voltage.cloud"
target="_blank"
rel="noopener noreferrer"
>
<q-img
contain
:src="($q.dark.isActive) ? '{{ static_url_for('static', 'images/voltage.png') }}' : '{{ static_url_for('static', 'images/voltagel.png') }}'"
></q-img>
</a>
</div>
<div>
<a
href="https://breez.technology/sdk/"
target="_blank"
rel="noopener noreferrer"
>
<q-img
contain
:src="($q.dark.isActive) ? '{{ static_url_for('static', 'images/breez.png') }}' : '{{ static_url_for('static', 'images/breezl.png') }}'"
></q-img>
</a>
</div>
<div>
<a
href="https://blockstream.com/lightning/greenlight/"
target="_blank"
rel="noopener noreferrer"
>
<q-img
contain
:src="($q.dark.isActive) ? '{{ static_url_for('static', 'images/greenlight.png') }}' : '{{ static_url_for('static', 'images/greenlightl.png') }}'"
></q-img>
</a>
</div>
<div>
<a
href="https://getalby.com"
target="_blank"
rel="noopener noreferrer"
>
<q-img
contain
:src="($q.dark.isActive) ? '{{ static_url_for('static', 'images/alby.png') }}' : '{{ static_url_for('static', 'images/albyl.png') }}'"
></q-img>
</a>
</div>
<div>
<a
href="https://zbd.gg"
target="_blank"
rel="noopener noreferrer"
>
<q-img
contain
:src="($q.dark.isActive) ? '{{ static_url_for('static', 'images/zbd.png') }}' : '{{ static_url_for('static', 'images/zbdl.png') }}'"
></q-img>
</a>
</div>
<div>
<a
href="https://phoenix.acinq.co/server"
target="_blank"
rel="noopener noreferrer"
>
<q-img
contain
:src="($q.dark.isActive) ? '{{ static_url_for('static', 'images/phoenixd.png') }}' : '{{ static_url_for('static', 'images/phoenixdl.png') }}'"
></q-img>
</a>
</div>
<div>
<a
href="https://boltz.exchange/"
target="_blank"
rel="noopener noreferrer"
>
<q-img
contain
:src="($q.dark.isActive) ? '{{ static_url_for('static', 'images/boltz.svg') }}' : '{{ static_url_for('static', 'images/boltz.svg') }}'"
></q-img>
</a>
</div>
<!-- # -->
</div>
</div>
</div>
</div>
</div>
{% if AD_SPACE %}
<div class="row justify-center q-mt-xl">
<div class="full-width q-mb-md text-center">
<span class="text-uppercase text-grey">{{ AD_SPACE_TITLE }}</span>
</div>
<div class="flex flex-center columm">
{% for ADS in AD_SPACE %} {% set AD = ADS.split(';') %}
<div class="flex flex-center column">
<a href="{{ AD[0] }}">
<img
v-if="($q.dark.isActive)"
src="{{ AD[1] }}"
style="max-width: 420px"
class="full-width"
/>
<img
v-else
src="{{ AD[2] }}"
style="max-width: 420px"
class="full-width"
/>
<img v-else src="{{ AD[2] }}" style="max-width: 420px" />
</a>
</div>
{% endfor %}
</div>
{% endif %}
<div
v-if="'{{LNBITS_SHOW_HOME_PAGE_ELEMENTS}}' == 'True'"
class="row gt-sm q-mt-xl"
>
<div class="col-1"></div>
<div class="col-10 q-pl-xl">
<span v-text="$t('lnbits_description')"></span>
</div>
<div class="col-1"></div>
</div>
</div>
{% endif %} {% endblock %}
</q-page>
</q-page-container>
{% endblock %}

View file

@ -428,14 +428,14 @@ async def hex_to_uuid4(hex_value: str):
@generic_router.get("/lnurlwallet", response_class=RedirectResponse)
async def lnurlwallet(request: Request):
async def lnurlwallet(request: Request, lightning: str = ""):
"""
If a user doesn't have a Lightning Network wallet and scans the LNURLw QR code with
their smartphone camera, or a QR scanner app, they can follow the link provided to
claim their satoshis and get an instant LNbits wallet! lnbits/withdraw docs
"""
lightning_param = request.query_params.get("lightning")
lightning_param = lightning
if not lightning_param:
return {"status": "ERROR", "reason": "lightning parameter not provided."}
if not settings.lnbits_allow_new_accounts:
@ -459,20 +459,19 @@ async def lnurlwallet(request: Request):
)
account = await create_user_account()
wallet = await create_wallet(user_id=account.id)
_, payment_request = await create_invoice(
payment = await create_invoice(
wallet_id=wallet.id,
amount=data1.get("maxWithdrawable") / 1000,
memo=data1.get("defaultDescription", "lnurl wallet withdraw"),
)
url = data1.get("callback")
params = {"k1": data1.get("k1"), "pr": payment_request}
params = {"k1": data1.get("k1"), "pr": payment.bolt11}
callback = url + ("&" if urlparse(url).query else "?") + urlencode(params)
res2 = await client.get(callback, timeout=2)
res2.raise_for_status()
return RedirectResponse(
f"/wallet?usr={account.id}&wal={wallet.id}",
f"/wallet?wal={wallet.id}",
)

View file

@ -76,6 +76,7 @@ def template_renderer(additional_folders: Optional[list] = None) -> Jinja2Templa
t.env.globals["LNBITS_SHOW_HOME_PAGE_ELEMENTS"] = (
settings.lnbits_show_home_page_elements
)
t.env.globals["LNBITS_CUSTOM_IMAGE"] = settings.lnbits_custom_image
t.env.globals["LNBITS_CUSTOM_BADGE"] = settings.lnbits_custom_badge
t.env.globals["LNBITS_CUSTOM_BADGE_COLOR"] = settings.lnbits_custom_badge_color
t.env.globals["LNBITS_THEME_OPTIONS"] = settings.lnbits_theme_options

View file

@ -215,7 +215,6 @@ class InstalledExtensionsSettings(LNbitsSettings):
class ExchangeHistorySettings(LNbitsSettings):
lnbits_exchange_rate_history: list[dict] = Field(default=[])
def append_exchange_rate_datapoint(self, rates: dict, max_size: int):
@ -250,6 +249,9 @@ class ThemesSettings(LNbitsSettings):
]
)
lnbits_custom_logo: Optional[str] = Field(default=None)
lnbits_custom_image: Optional[str] = Field(
default="/static/images/logos/lnbits.svg"
)
lnbits_ad_space_title: str = Field(default="Supported by")
lnbits_ad_space: str = Field(
default="https://shop.lnbits.com/;/static/images/bitcoin-shop-banner.png;/static/images/bitcoin-shop-banner.png,https://affil.trezor.io/aff_c?offer_id=169&aff_id=33845;/static/images/bitcoin-hardware-wallet.png;/static/images/bitcoin-hardware-wallet.png,https://opensats.org/;/static/images/open-sats.png;/static/images/open-sats.png"
@ -272,7 +274,6 @@ class OpsSettings(LNbitsSettings):
class FeeSettings(LNbitsSettings):
lnbits_reserve_fee_min: int = Field(default=2000)
lnbits_reserve_fee_percent: float = Field(default=1.0)
lnbits_service_fee: float = Field(default=0)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -263,13 +263,14 @@ window.localisation.en = {
enable_server_log: 'Enable Server Log',
coming_soon: 'Feature coming soon',
session_has_expired: 'Your session has expired. Please login again.',
instant_access_question: 'Want instant access?',
instant_access_question: 'or instant access',
login_with_user_id: 'Login with user ID',
or: 'or',
create_new_wallet: 'Create New Wallet',
login_to_account: 'Login to your account',
create_account: 'Create account',
account_settings: 'Account Settings',
signin_with_oauth: 'or Login with',
signin_with_nostr: 'Continue with Nostr',
signin_with_google: 'Sign in with Google',
signin_with_github: 'Sign in with GitHub',
@ -458,6 +459,9 @@ window.localisation.en = {
denomination_hint: 'The name for the FakeWallet token',
ui_qr_code_logo: 'QR Code Logo',
ui_qr_code_logo_hint: 'URL to logo image in QR code',
ui_custom_image: 'Custom Image',
ui_custom_image_label: 'URL to custom image',
ui_custom_image_hint: 'Image showed at homepage/login',
ui_custom_badge: 'Custom Badge',
ui_custom_badge_label:
"Custom Badge 'USE WITH CAUTION - LNbits wallet is still in BETA'",

View file

@ -744,7 +744,6 @@ window.windowMixin = {
)
.onOk(async () => {
try {
this.$q.localStorage.remove('lnbits.disclaimerShown')
await LNbits.api.logout()
window.location = '/'
} catch (e) {

View file

@ -498,3 +498,123 @@ window.app.component('lnbits-update-balance', {
}
}
})
window.app.component('user-id-only', {
template: '#user-id-only',
mixins: [window.windowMixin],
props: {
allowed_new_users: Boolean,
authAction: String,
authMethod: String,
usr: String,
wallet: String
},
data() {
return {
user: this.usr,
walletName: this.wallet
}
},
methods: {
showLogin(method) {
this.$emit('show-login', method)
},
showRegister(method) {
this.$emit('show-register', method)
},
loginUsr() {
this.$emit('update:user', this.user)
this.$emit('login-usr')
},
createWallet() {
this.$emit('update:wallet', this.walletName)
this.$emit('create-wallet')
}
},
computed: {
showInstantLogin() {
// do not show if authmethod is 'username-password' and authAction is 'register'
return (
this.authMethod !== 'username-password' ||
this.authAction !== 'register'
)
}
},
created() {}
})
window.app.component('username-password', {
template: '#username-password',
mixins: [window.windowMixin],
props: {
allowed_new_users: Boolean,
authMethods: Array,
authAction: String,
username: String,
password_1: String,
password_2: String,
resetKey: String
},
data() {
return {
oauth: [
'nostr-auth-nip98',
'google-auth',
'github-auth',
'keycloak-auth'
],
username: this.userName,
password: this.password_1,
passwordRepeat: this.password_2,
reset_key: this.resetKey
}
},
methods: {
login() {
this.$emit('update:userName', this.username)
this.$emit('update:password_1', this.password)
this.$emit('login')
},
register() {
this.$emit('update:userName', this.username)
this.$emit('update:password_1', this.password)
this.$emit('update:password_2', this.passwordRepeat)
this.$emit('register')
},
reset() {
this.$emit('update:resetKey', this.reset_key)
this.$emit('update:passeord_1', this.password)
this.$emit('update:password_2', this.passwordRepeat)
this.$emit('reset')
},
validateUsername(val) {
const usernameRegex = new RegExp(
'^(?=[a-zA-Z0-9._]{2,20}$)(?!.*[_.]{2})[^_.].*[^_.]$'
)
return usernameRegex.test(val)
}
},
computed: {
showOauth() {
return this.oauth.some(m => this.authMethods.includes(m))
}
},
created() {
console.log('username-password created', this.passwordRepeat)
}
})
window.app.component('separator-text', {
template: '#separator-text',
props: {
text: String,
uppercase: {
type: Boolean,
default: false
},
color: {
type: String,
default: 'grey'
}
}
})

View file

@ -9,7 +9,9 @@ window.app = Vue.createApp({
description: ''
},
isUserAuthorized: false,
authAction: 'login',
authAction: Quasar.LocalStorage.getItem('lnbits.disclaimerShown')
? 'login'
: 'register',
authMethod: 'username-password',
usr: '',
username: '',
@ -18,7 +20,9 @@ window.app = Vue.createApp({
password: '',
passwordRepeat: '',
walletName: '',
signup: false
signup: false,
slide: 1,
autoplay: true
}
},
computed: {
@ -170,15 +174,10 @@ window.app = Vue.createApp({
message: 'Processing...',
icon: null
})
},
validateUsername(val) {
const usernameRegex = new RegExp(
'^(?=[a-zA-Z0-9._]{2,20}$)(?!.*[_.]{2})[^_.].*[^_.]$'
)
return usernameRegex.test(val)
}
},
created() {
console.log(Quasar.LocalStorage.getItem('lnbits.disclaimerShown'))
this.description = SITE_DESCRIPTION
this.isUserAuthorized = !!this.$q.cookies.get('is_lnbits_user_authorized')
if (this.isUserAuthorized) {

View file

@ -847,18 +847,18 @@ window.WalletPageLogic = {
}
},
mounted() {
if (!this.$q.localStorage.getItem('lnbits.disclaimerShown')) {
if (!Quasar.LocalStorage.getItem('lnbits.disclaimerShown')) {
this.disclaimerDialog.show = true
this.$q.localStorage.set('lnbits.disclaimerShown', true)
this.$q.localStorage.set('lnbits.reactions', 'confettiTop')
Quasar.LocalStorage.setItem('lnbits.disclaimerShown', true)
Quasar.LocalStorage.setItem('lnbits.reactions', 'confettiTop')
}
if (this.$q.localStorage.getItem('lnbits.isPrioritySwapped')) {
this.isPrioritySwapped = this.$q.localStorage.getItem(
if (Quasar.LocalStorage.getItem('lnbits.isPrioritySwapped')) {
this.isPrioritySwapped = Quasar.LocalStorage.getItem(
'lnbits.isPrioritySwapped'
)
} else {
this.isPrioritySwapped = false
this.$q.localStorage.setItem('lnbits.isPrioritySwapped', false)
Quasar.LocalStorage.setItem('lnbits.isPrioritySwapped', false)
}
}
}

View file

@ -1054,3 +1054,329 @@
</q-dialog>
</span>
</template>
<template id="user-id-only">
<div v-if="authAction === 'login' && authMethod === 'user-id-only'">
<q-card-section class="q-pb-none">
<div class="text-center text-h6">
<span v-text="$t('login_with_user_id')"></span>
</div>
</q-card-section>
<q-card-section>
<q-form @submit="loginUsr" class="q-gutter-md">
<q-input
dense
filled
v-model="user"
label="usr"
type="password"
></q-input>
<q-card-actions vertical align="center" class="q-pa-none">
<q-btn
color="primary"
:disable="user == ''"
type="submit"
:label="$t('login')"
class="full-width q-mb-sm"
></q-btn>
<q-btn
@click="showLogin('username-password')"
outline
color="grey"
:label="$t('back')"
class="full-width"
></q-btn>
</q-card-actions>
</q-form>
</q-card-section>
</div>
<div v-if="authAction === 'register' && authMethod === 'user-id-only'">
<q-card-section class="q-pb-none">
<div class="text-center text-h6">
<span v-text="$t('create_new_wallet')"></span>
</div>
</q-card-section>
<q-card-section>
<q-form @submit="createWallet" class="q-gutter-md">
<q-input
dense
filled
v-model="walletName"
:label="$t('name_your_wallet', {name: '{{ SITE_TITLE }} *'})"
></q-input>
<q-card-actions vertical align="center" class="q-pa-none">
<q-btn
color="primary"
:disable="walletName == ''"
type="submit"
:label="$t('add_wallet')"
class="full-width q-mb-sm"
></q-btn>
<q-btn
@click="showLogin('username-password')"
outline
color="grey"
:label="$t('back')"
class="full-width"
></q-btn>
</q-card-actions>
</q-form>
</q-card-section>
</div>
<q-card-section v-show="showInstantLogin">
<div>
<separator-text :text="$t('instant_access_question')"></separator-text>
<div class="text-body2 text-center q-mt-md">
<q-badge
@click="showLogin('user-id-only')"
color="accent"
class="cursor-pointer"
rounded
>
<strong>
<q-icon name="account_circle" size="xs"></q-icon>
<span v-text="$t('login_with_user_id')"></span> </strong
></q-badge>
<div v-if="allowed_new_users" class="inline-block">
<span v-text="$t('or')" class="q-mx-sm text-grey"></span>
<q-badge
@click="showRegister('user-id-only')"
color="accent"
class="cursor-pointer"
rounded
>
<strong>
<q-icon name="add" size="xs"></q-icon>
<span v-text="$t('create_new_wallet')"></span>
</strong>
</q-badge>
</div>
</div>
</div>
</q-card-section>
</template>
<template id="username-password">
<q-card-section class="q-pb-none">
<div class="text-center text-h6 q-mb-sm q-mt-none q-pt-none">
<span
v-if="authAction === 'login'"
v-text="$t('login_to_account')"
></span>
<span
v-if="authAction === 'register'"
v-text="$t('create_account')"
></span>
<span v-if="authAction === 'reset'" v-text="$t('reset_password')"></span>
</div>
</q-card-section>
<!-- LOGIN -->
<q-card-section v-if="authAction === 'login'">
<q-form @submit="login" class="q-gutter-sm">
<q-input
dense
filled
v-model="username"
name="username"
:label="$t('username_or_email') + ' *'"
></q-input>
<q-input
dense
filled
v-model="password"
name="password"
:label="$t('password') + ' *'"
type="password"
></q-input>
<div class="row justify-end">
<q-btn
:disable="!username || !password"
color="primary"
type="submit"
:label="$t('login')"
class="full-width"
></q-btn>
</div>
</q-form>
</q-card-section>
<!-- REGISTER -->
<q-card-section v-if="authAction === 'register'">
<q-form @submit="register" class="q-gutter-sm">
<q-input
dense
filled
required
v-model="username"
:label="$t('username') + ' *'"
:rules="[val => validateUsername(val) || $t('invalid_username')]"
></q-input>
<q-input
dense
filled
v-model="password"
:label="$t('password') + ' *'"
type="password"
:rules="[val => !val || val.length >= 8 || $t('invalid_password')]"
></q-input>
<q-input
dense
filled
v-model="passwordRepeat"
:label="$t('password_repeat') + ' *'"
type="password"
:rules="[val => !val || val.length >= 8 || $t('invalid_password')]"
></q-input>
<div class="row justify-end">
<q-btn
unelevated
color="primary"
:disable="
!password ||
!passwordRepeat ||
!username ||
password !== passwordRepeat
"
type="submit"
class="full-width"
:label="$t('create_account')"
></q-btn>
</div>
</q-form>
</q-card-section>
<slot></slot>
<!-- RESET -->
<q-card-section v-if="authAction === 'reset'">
<q-form @submit="reset" class="q-gutter-sm">
<q-input
dense
filled
required
:disable="true"
v-model="reset_key"
:label="$t('reset_key') + ' *'"
></q-input>
<q-input
dense
filled
v-model="password"
:label="$t('password') + ' *'"
type="password"
:rules="[val => !val || val.length >= 8 || $t('invalid_password')]"
></q-input>
<q-input
dense
filled
v-model="passwordRepeat"
:label="$t('password_repeat') + ' *'"
type="password"
:rules="[val => !val || val.length >= 8 || $t('invalid_password')]"
></q-input>
<div class="row justify-end">
<q-btn
unelevated
color="primary"
:disable="
!password ||
!passwordRepeat ||
!reset_key ||
password !== passwordRepeat
"
type="submit"
class="full-width"
:label="$t('reset_password')"
></q-btn>
</div>
</q-form>
</q-card-section>
<!-- OAUTH -->
<q-card-section v-if="showOauth">
<separator-text :text="$t('signin_with_oauth')"></separator-text>
<div class="flex justify-center q-mt-md" style="gap: 1rem">
<q-btn
v-if="authMethods.includes('nostr-auth-nip98')"
@click="signInWithNostr"
outline
no-caps
color="grey"
padding="sm md"
>
<div class="row items-center no-wrap">
<q-avatar size="32px">
<q-img
class="bg-primary"
:src="`{{ static_url_for('static', 'images/logos/nostr.svg') }}`"
></q-img>
</q-avatar>
</div>
<q-tooltip>
<span v-text="$t('signin_with_nostr')"></span>
</q-tooltip>
</q-btn>
<q-btn
v-if="authMethods.includes('github-auth')"
href="/api/v1/auth/github"
type="a"
outline
no-caps
color="grey"
padding="sm md"
>
<div class="row items-center no-wrap">
<q-avatar size="32px">
<q-img
:src="`{{ static_url_for('static', 'images/github-logo.png') }}`"
:style="$q.dark.isActive ? 'filter: grayscale(1) invert(1)' : ''"
></q-img>
</q-avatar>
</div>
<q-tooltip><span v-text="$t('signin_with_github')"></span></q-tooltip>
</q-btn>
<q-btn
v-if="authMethods.includes('google-auth')"
href="/api/v1/auth/google"
type="a"
outline
no-caps
color="grey"
padding="sm md"
>
<div class="row items-center no-wrap">
<q-avatar size="32px">
<q-img
:src="`{{ static_url_for('static', 'images/google-logo.png') }}`"
></q-img>
</q-avatar>
</div>
<q-tooltip>
<span v-text="$t('signin_with_google')"></span>
</q-tooltip>
</q-btn>
<q-btn
v-if="authMethods.includes('keycloak-auth')"
href="/api/v1/auth/keycloak"
type="a"
outline
no-caps
color="grey"
class="btn-fixed-width"
>
<q-avatar size="32px" class="q-mr-md">
<q-img
:src="`{{ static_url_for('static', 'images/keycloak-logo.png') }}`"
></q-img>
</q-avatar>
<div><span v-text="$t('signin_with_keycloak')"></span></div>
</q-btn>
</div>
</q-card-section>
</template>
<template id="separator-text">
<div class="row fit no-wrap items-center">
<q-separator class="col q-mr-sm"></q-separator>
<div class="col-grow q-mx-sm">
<span :class="`text-h6 text-${color}`" v-text="text"></span>
</div>
<q-separator class="col q-ml-sm"></q-separator>
</div>
</template>