From d787a9aca0bdc166402f7d495fe797c88d7e8fa0 Mon Sep 17 00:00:00 2001 From: Bernhard Haumacher <haui@haumacher.de> Date: Tue, 3 Dec 2024 22:40:30 +0100 Subject: [PATCH] Issue #111: Fixed page flow after login/signup/password-reset. --- .../phoneblock/app/LoginServlet.java | 43 ++++++++++++---- .../phoneblock/app/SettingsServlet.java | 6 +-- .../phoneblock/mail/MailService.java | 3 +- .../main/webapp/anrufbeantworter/index.jsp | 33 +++++++++++- phoneblock/src/main/webapp/login.jsp | 7 +-- phoneblock/src/main/webapp/phone-info.jsp | 7 +-- phoneblock/src/main/webapp/settings.jsp | 51 +++++++++++++------ .../setup-android/07-people-sync-add.jsp | 5 +- .../src/main/webapp/setup-iphone/index.jsp | 7 +-- phoneblock/src/main/webapp/setup.jsp | 4 +- phoneblock/src/main/webapp/signup-code.jsp | 4 +- phoneblock/src/main/webapp/signup.jsp | 11 ++-- .../src/main/webapp/support-banktransfer.jsp | 2 +- phoneblock/src/main/webapp/support.jsp | 17 ++++++- 14 files changed, 148 insertions(+), 52 deletions(-) diff --git a/phoneblock/src/main/java/de/haumacher/phoneblock/app/LoginServlet.java b/phoneblock/src/main/java/de/haumacher/phoneblock/app/LoginServlet.java index e6d5e399..24364977 100644 --- a/phoneblock/src/main/java/de/haumacher/phoneblock/app/LoginServlet.java +++ b/phoneblock/src/main/java/de/haumacher/phoneblock/app/LoginServlet.java @@ -47,7 +47,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se if (LoginFilter.getAuthenticatedUser(req.getSession(false)) != null) { String location = location(req); if (location == null) { - location = "/settings.jsp"; + location = SettingsServlet.PATH; } resp.sendRedirect(req.getContextPath() + location); return; @@ -121,6 +121,17 @@ private static String locationParam(HttpServletRequest request, boolean first) { /** * Creates an URL parameter transporting the location after login to the next link invocation. */ + public static String locationParam(String location) { + return locationParam(location, false); + } + + /** + * Creates an URL parameter transporting the location after login to the next link invocation. + */ + public static String locationParamFirst(String location) { + return locationParam(location, true); + } + public static String locationParam(String location, boolean first) { String locationParam; if (location != null) { @@ -132,17 +143,31 @@ public static String locationParam(String location, boolean first) { } /** - * The location after login transmitted with the given request. + * The location after login transmitted with the given request, or the current page. */ public static String location(HttpServletRequest request) { - String location = (String) request.getAttribute(LoginServlet.LOCATION_ATTRIBUTE); - if (location == null) { - location = (String) request.getParameter(LoginServlet.LOCATION_ATTRIBUTE); - if (location == null) { - location = ServletUtil.currentPage(request).substring(request.getContextPath().length()); - } + return location(request, null); + } + + /** + * The location after login transmitted with the given request, or the given default location, or the current page. + */ + public static String location(HttpServletRequest request, String defaultLocation) { + String locationAttribute = (String) request.getAttribute(LoginServlet.LOCATION_ATTRIBUTE); + if (locationAttribute != null) { + return locationAttribute; } - return location; + + String locationParam = (String) request.getParameter(LoginServlet.LOCATION_ATTRIBUTE); + if (locationParam != null) { + return locationParam; + } + + if (defaultLocation != null) { + return defaultLocation; + } + + return ServletUtil.currentPage(request).substring(request.getContextPath().length()); } /** diff --git a/phoneblock/src/main/java/de/haumacher/phoneblock/app/SettingsServlet.java b/phoneblock/src/main/java/de/haumacher/phoneblock/app/SettingsServlet.java index 477c1d47..89e1211d 100644 --- a/phoneblock/src/main/java/de/haumacher/phoneblock/app/SettingsServlet.java +++ b/phoneblock/src/main/java/de/haumacher/phoneblock/app/SettingsServlet.java @@ -86,7 +86,7 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S return; default: - resp.sendRedirect(req.getContextPath() + "/settings"); + resp.sendRedirect(req.getContextPath() + SettingsServlet.PATH); } } } @@ -140,7 +140,7 @@ else if (key.startsWith("wl-")) { AddressBookCache.getInstance().flushUserCache(userName); - resp.sendRedirect(req.getContextPath() + "/settings"); + resp.sendRedirect(req.getContextPath() + SettingsServlet.PATH); } private String normalize(String value) { @@ -203,7 +203,7 @@ else if (maxLength <= 5000) { // Ensure that a new block list is created, if the user is experimenting with the possible block list size. AddressBookCache.getInstance().flushUserCache(userName); - resp.sendRedirect(req.getContextPath() + "/settings"); + resp.sendRedirect(req.getContextPath() + SettingsServlet.PATH); } private void sendFailure(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { diff --git a/phoneblock/src/main/java/de/haumacher/phoneblock/mail/MailService.java b/phoneblock/src/main/java/de/haumacher/phoneblock/mail/MailService.java index 349ad128..c7412a49 100644 --- a/phoneblock/src/main/java/de/haumacher/phoneblock/mail/MailService.java +++ b/phoneblock/src/main/java/de/haumacher/phoneblock/mail/MailService.java @@ -20,6 +20,7 @@ import org.slf4j.LoggerFactory; import de.haumacher.phoneblock.app.Application; +import de.haumacher.phoneblock.app.SettingsServlet; import de.haumacher.phoneblock.db.DBUserSettings; import de.haumacher.phoneblock.db.settings.AnswerBotSip; import de.haumacher.phoneblock.mail.check.EMailCheckService; @@ -80,7 +81,7 @@ public MailService(String user, String password, Properties properties) { String baseUrl = HOME_PAGE + contextPath; _appLogoSvg = baseUrl + "/app-logo.svg"; - _settings = baseUrl + "/settings"; + _settings = baseUrl + SettingsServlet.PATH; _app = baseUrl + "/ab/"; _support = baseUrl + "/support.jsp"; } diff --git a/phoneblock/src/main/webapp/anrufbeantworter/index.jsp b/phoneblock/src/main/webapp/anrufbeantworter/index.jsp index c53d3294..e655b63c 100644 --- a/phoneblock/src/main/webapp/anrufbeantworter/index.jsp +++ b/phoneblock/src/main/webapp/anrufbeantworter/index.jsp @@ -1,4 +1,6 @@ <!DOCTYPE html> +<%@page import="de.haumacher.phoneblock.app.SettingsServlet"%> +<%@page import="de.haumacher.phoneblock.app.RegistrationServlet"%> <%@page import="de.haumacher.phoneblock.app.LoginFilter"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" session="false"%> <%@page import="de.haumacher.phoneblock.util.JspUtil"%> @@ -62,11 +64,12 @@ <% String userName = LoginFilter.getAuthenticatedUser(request.getSession(false)); + Object token = RegistrationServlet.getPassword(request.getSession(false)); if (userName == null) { %> <p> Als erstes musst Du Dich - <a href="<%=request.getContextPath()%>/signup.jsp?locationAfterLogin=/anrufbeantworter/#create">bei PhoneBlock registrieren</a>. + <a href="<%=request.getContextPath()%>/signup.jsp?locationAfterLogin=/anrufbeantworter/#register">bei PhoneBlock registrieren</a>. Wenn Du bereits einen PhoneBlock-Account hast, <a href="<%=request.getContextPath()%>/login.jsp?locationAfterLogin=/anrufbeantworter/#create">melde Dich an</a>. </p> @@ -90,8 +93,34 @@ </div> <% } else { %> <p> - Du bist bereits angemeldet, prima, gleich zum nächsten Schritt! + Du bist als <code><%= JspUtil.quote(userName)%></code> angemeldet, prima, gleich zum nächsten Schritt! </p> + +<% if (token != null) { %> + <article class="message is-info"> + <div class="message-header"> + <p>Deine Zugangsdaten</p> + </div> + + <div class="message-body"> + <div class="field"> + <label class="label">Benutzername</label> + <div class="control"><code id="login"><%= JspUtil.quote(userName) %></code> <a id="login_" title="In die Zwischenablage kopieren." class="copyToClipboard"><i class="fa-solid fa-copy"></i></a></div> + <p class="help">Diesen Wert musst du als Benutzernamen für den <a href="<%=request.getContextPath()%>/setup.jsp">Abruf der Blocklist</a> eintragen. </p> + </div> + <div class="field"> + <label class="label">Passwort</label> + <div class="control"><code id="passwd"><%= JspUtil.quote(token) %></code> <a id="passwd_" title="In die Zwischenablage kopieren." href="#" class="copyToClipboard"><i class="fa-solid fa-copy"></i></a></div> + <p class="help">Dieses Passwort musst Du für die <a href="<%=request.getContextPath()%><%=SettingsServlet.PATH%>">Anmeldung an dieser Webseite</a> verwenden. </p> + <p class="help"> + Bitte notiere Dir das Passwort (oder speichere es am besten in einem <a href="https://keepass.info/">Passwort-Manager</a>), + denn es wird nur solange angezeigt bis Du Dich abmeldest, oder Deine Sitzung abläuft. + </p> + </div> + </div> + </article> +<% } %> + <% }%> <h2 id="create">Schritt 2: Anrufbeantworter erstellen</h2> diff --git a/phoneblock/src/main/webapp/login.jsp b/phoneblock/src/main/webapp/login.jsp index deb767cf..2b69c29c 100644 --- a/phoneblock/src/main/webapp/login.jsp +++ b/phoneblock/src/main/webapp/login.jsp @@ -1,4 +1,5 @@ <!DOCTYPE html> +<%@page import="de.haumacher.phoneblock.app.SettingsServlet"%> <%@page import="java.net.URLEncoder"%> <%@page import="java.net.URL"%> <%@page import="de.haumacher.phoneblock.app.LoginServlet"%> @@ -39,9 +40,9 @@ </div> <% - String location = LoginServlet.location(request); - String locationParam = LoginServlet.locationParam(request); - String locationParamFirst = LoginServlet.locationParamFirst(request); + String location = LoginServlet.location(request, SettingsServlet.PATH); + String locationParam = LoginServlet.locationParam(location); + String locationParamFirst = LoginServlet.locationParamFirst(location); %> <nav class="panel"> diff --git a/phoneblock/src/main/webapp/phone-info.jsp b/phoneblock/src/main/webapp/phone-info.jsp index 2fa47a05..a49d5407 100644 --- a/phoneblock/src/main/webapp/phone-info.jsp +++ b/phoneblock/src/main/webapp/phone-info.jsp @@ -1,4 +1,5 @@ <!DOCTYPE html> +<%@page import="de.haumacher.phoneblock.app.LoginServlet"%> <%@page import="de.haumacher.phoneblock.app.UIProperties"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" session="false"%> <%@page import="de.haumacher.phoneblock.app.api.CommentVoteServlet"%> @@ -331,7 +332,7 @@ </p> <p> - Damit Deine Bewertung sofort einen Einfluss auf Deine Blocklist hat, <a href="<%= request.getContextPath() %>/login.jsp">melde Dich vorher an</a>! + Damit Deine Bewertung sofort einen Einfluss auf Deine Blocklist hat, <a href="<%= request.getContextPath() %>/login.jsp<%= LoginServlet.locationParamFirst(request) %>">melde Dich vorher an</a>! </p> <div class="buttons"> @@ -500,7 +501,7 @@ </div> <div class="tile is-parent is-6"> - <a class="tile is-child notification is-info" href="<%=request.getContextPath() %>/signup.jsp"> + <a class="tile is-child notification is-info" href="<%=request.getContextPath() %>/signup.jsp<%= LoginServlet.locationParamFirst(request) %>"> <p class="title">PhoneBlock installieren</p> <p class="subtitle">Noch nicht installiert? Dann los!</p> </a> @@ -513,7 +514,7 @@ <div class="tile is-ancestor"> <div class="tile is-parent is-6"> - <a class="tile is-child notification is-primary" href="<%=request.getContextPath() %>/signup.jsp"> + <a class="tile is-child notification is-primary" href="<%=request.getContextPath() %>/signup.jsp<%= LoginServlet.locationParamFirst(request) %>"> <p class="title">PhoneBlock installieren</p> <p class="subtitle">Account erstellen und einrichten!</p> </a> diff --git a/phoneblock/src/main/webapp/settings.jsp b/phoneblock/src/main/webapp/settings.jsp index 6b7c5639..cda70c3f 100644 --- a/phoneblock/src/main/webapp/settings.jsp +++ b/phoneblock/src/main/webapp/settings.jsp @@ -1,4 +1,6 @@ <!DOCTYPE html> +<%@page import="de.haumacher.phoneblock.app.LoginServlet"%> +<%@page import="de.haumacher.phoneblock.app.RegistrationServlet"%> <%@page import="de.haumacher.phoneblock.app.SettingsServlet"%> <%@page import="java.util.List"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" session="true"%> @@ -19,6 +21,7 @@ <% String userName = LoginFilter.getAuthenticatedUser(session); + Object token = RegistrationServlet.getPassword(session); %> <body> <jsp:include page="header.jspf"></jsp:include> @@ -29,7 +32,7 @@ <h1>Einstellungen</h1> <p> - Um deine persönlichen Einstellungen zu bearbeiten, musst Du Dich <a href="<%= request.getContextPath()%>/login.jsp">anmelden</a>. + Um deine persönlichen Einstellungen zu bearbeiten, musst Du Dich <a href="<%= request.getContextPath()%>/login.jsp<%= LoginServlet.locationParamFirst(request) %>">anmelden</a>. </p> </div> </section> @@ -44,18 +47,36 @@ Wilkommen <%= JspUtil.quote(settings.getDisplayName()) %>. </p> - <form action="<%= request.getContextPath() %>/settings" method="post"> - <div class="field"> - <label class="label">Benutzername</label> - <div class="control has-icons-left"> - <input class="input" type="text" value="<%= JspUtil.quote(userName)%>" name="userName" disabled="disabled"> - <span class="icon is-small is-left"> - <i class="fa-solid fa-user"></i> - </span> + <form action="<%= request.getContextPath() %><%=SettingsServlet.PATH%>" method="post"> + +<% if (token != null) { %> + <article class="message is-info"> + <div class="message-header"> + <p>Deine Zugangsdaten</p> </div> - <p class="help">Diesen Wert musst du als Benutzernamen für den <a href="<%=request.getContextPath()%>/setup.jsp">Abruf der Blocklist</a> eintragen. </p> - </div> - + + <div class="message-body"> +<% } %> + <div class="field"> + <label class="label">Benutzername</label> + <div class="control"><code id="login"><%= JspUtil.quote(userName) %></code> <a id="login_" title="In die Zwischenablage kopieren." class="copyToClipboard"><i class="fa-solid fa-copy"></i></a></div> + <p class="help">Diesen Wert musst du als Benutzernamen für den <a href="<%=request.getContextPath()%>/setup.jsp">Abruf der Blocklist</a> eintragen. </p> + </div> + +<% if (token != null) { %> + <div class="field"> + <label class="label">Passwort</label> + <div class="control"><code id="passwd"><%= JspUtil.quote(token) %></code> <a id="passwd_" title="In die Zwischenablage kopieren." href="#" class="copyToClipboard"><i class="fa-solid fa-copy"></i></a></div> + <p class="help">Dieses Passwort musst Du für die <a href="<%=request.getContextPath()%>/setup.jsp">Einrichtung des Telefonbuchs</a> oder für die <a href="<%=request.getContextPath()%><%=SettingsServlet.PATH%>">Anmeldung an dieser Webseite</a> verwenden. </p> + <p class="help"> + Bitte notiere Dir das Passwort (oder speichere es am besten in einem <a href="https://keepass.info/">Passwort-Manager</a>), + denn es wird nur solange angezeigt bis Du Dich abmeldest, oder Deine Sitzung abläuft. + </p> + </div> + </div> + </article> +<% } %> + <div class="field"> <label class="label">Maximale Blocklist-Größe</label> <div class="control has-icons-left"> @@ -148,7 +169,7 @@ List<String> blacklist = (List<String>) request.getAttribute("blacklist"); <div class="content"> <h2 id="blacklist">Deine Blacklist</h2> - <form action="<%= request.getContextPath() %>/settings?action=lists" method="post"> + <form action="<%= request.getContextPath() %><%=SettingsServlet.PATH%>?action=lists" method="post"> <% if (blacklist.isEmpty()) { %> <p>Du hast keine Nummern explizit gesperrt. Um eine Nummer zu sperren, suche die Nummer über das Suchfeld oben und schreibe einen negativen Kommentar, oder mach in Deiner Fritz!Box einen Telefonbucheintrag für die Nummer in der Blocklist.</p> @@ -183,7 +204,7 @@ List<String> whitelist = (List<String>) request.getAttribute("whitelist"); <div class="content"> <h2 id="whitelist">Deine Whitelist</h2> - <form action="<%= request.getContextPath() %>/settings?action=lists" method="post"> + <form action="<%= request.getContextPath() %><%=SettingsServlet.PATH%>?action=lists" method="post"> <% if (whitelist.isEmpty()) { %> <p>Du hast keine Nummern von der Sperrung ausgenommen.</p> @@ -211,7 +232,7 @@ List<String> whitelist = (List<String>) request.getAttribute("whitelist"); </div> <div class="content"> - <form action="<%= request.getContextPath() %>/settings?action=lists" method="post"> + <form action="<%= request.getContextPath() %><%=SettingsServlet.PATH%>?action=lists" method="post"> <div class="field"> <label class="label">Ausnahme hinzufügen</label> diff --git a/phoneblock/src/main/webapp/setup-android/07-people-sync-add.jsp b/phoneblock/src/main/webapp/setup-android/07-people-sync-add.jsp index 38e92ce9..491bc6fc 100644 --- a/phoneblock/src/main/webapp/setup-android/07-people-sync-add.jsp +++ b/phoneblock/src/main/webapp/setup-android/07-people-sync-add.jsp @@ -1,4 +1,5 @@ <!DOCTYPE html> +<%@page import="de.haumacher.phoneblock.app.LoginServlet"%> <%@page import="de.haumacher.phoneblock.app.SettingsServlet"%> <%@page import="de.haumacher.phoneblock.app.RegistrationServlet"%> <%@page import="de.haumacher.phoneblock.app.LoginFilter"%> @@ -30,7 +31,7 @@ </li> <li> - Bei "Benutzername" trägst Du den Benutzernamen ein, den Du bei der <a href="<%=request.getContextPath() %>/signup.jsp">PhoneBlock-Anmeldung</a> erhalten hast<%if (login != null) {%> (<code id="login"><%= login %></code> <a id="login_" title="In die Zwischenablage kopieren." href="#" class="copyToClipboard"><i class="fa-solid fa-copy"></i></a>)<%}%>. + Bei "Benutzername" trägst Du den Benutzernamen ein, den Du bei der <a href="<%=request.getContextPath() %>/signup.jsp<%= LoginServlet.locationParamFirst(request) %>">PhoneBlock-Anmeldung</a> erhalten hast<%if (login != null) {%> (<code id="login"><%= login %></code> <a id="login_" title="In die Zwischenablage kopieren." href="#" class="copyToClipboard"><i class="fa-solid fa-copy"></i></a>)<%}%>. </li> <li> @@ -40,7 +41,7 @@ <p> Du hast die Daten nicht mehr zur Hand? Macht nichts, einfach - <a href="<%=request.getContextPath() %>/signup.jsp">erneut registrieren</a> oder in den <a href="<%=request.getContextPath() + SettingsServlet.PATH %>">Einstellungen</a> das Passwort zurücksetzen. + <a href="<%=request.getContextPath() %>/signup.jsp<%= LoginServlet.locationParamFirst(request) %>">erneut registrieren</a> oder in den <a href="<%=request.getContextPath() + SettingsServlet.PATH %>">Einstellungen</a> das Passwort zurücksetzen. </p> <div class="columns"> diff --git a/phoneblock/src/main/webapp/setup-iphone/index.jsp b/phoneblock/src/main/webapp/setup-iphone/index.jsp index 38e7e63f..7f3a1730 100644 --- a/phoneblock/src/main/webapp/setup-iphone/index.jsp +++ b/phoneblock/src/main/webapp/setup-iphone/index.jsp @@ -1,4 +1,5 @@ <!DOCTYPE html> +<%@page import="de.haumacher.phoneblock.app.LoginServlet"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" session="false"%> <%@page import="de.haumacher.phoneblock.app.SettingsServlet"%> <%@page import="de.haumacher.phoneblock.app.RegistrationServlet"%> @@ -36,7 +37,7 @@ %> <ol> - <li><a href="<%=request.getContextPath() %>/signup.jsp">Melde Dich bei PhoneBlock an.</a></li> + <li><a href="<%=request.getContextPath() %>/signup.jsp<%= LoginServlet.locationParamFirst(request) %>">Melde Dich bei PhoneBlock an.</a></li> <li>Öffne "Einstellungen" > "Kontakte" > "Accounts". </li> <li>Tippe auf "Account hinzufügen" - "Andere" > "CardDAV-Account hinzufügen".</li> <li>Gib deine Zugangsdaten ein und tippe auf "Weiter". @@ -72,7 +73,7 @@ <p> Du hast die Zugangsdaten nicht mehr zur Hand? Macht nichts, einfach - <a href="<%=request.getContextPath() %>/signup.jsp">erneut registrieren</a> oder in den <a href="<%=request.getContextPath() + SettingsServlet.PATH %>">Einstellungen</a> das Passwort zurücksetzen. + <a href="<%=request.getContextPath() %>/signup.jsp<%= LoginServlet.locationParamFirst(request) %>">erneut registrieren</a> oder in den <a href="<%=request.getContextPath() + SettingsServlet.PATH %>">Einstellungen</a> das Passwort zurücksetzen. </p> <p> @@ -82,7 +83,7 @@ </p> <p> - Wenn du PhoneBlock nur auf dem iPhone benutzt kannst du auch die Anzahl der Einträge <a href="<%= request.getContextPath()%>/settings">hier</a> höher stellen. + Wenn du PhoneBlock nur auf dem iPhone benutzt kannst du auch die Anzahl der Einträge <a href="<%= request.getContextPath()%><%=SettingsServlet.PATH%>">hier</a> höher stellen. Sollte es damit Probleme geben, dann melde Dich bitte (siehe <a href="<%=request.getContextPath() %>/faq.jsp">FAQ</a>). </p> </div> diff --git a/phoneblock/src/main/webapp/setup.jsp b/phoneblock/src/main/webapp/setup.jsp index bb2be154..f386a938 100644 --- a/phoneblock/src/main/webapp/setup.jsp +++ b/phoneblock/src/main/webapp/setup.jsp @@ -46,7 +46,7 @@ <div class="columns"> <div class="column is-half is-offset-one-quarter"> - <a href="<%=request.getContextPath() %>/signup.jsp"> + <a href="<%=request.getContextPath() %>/signup.jsp<%= LoginServlet.locationParamFirst(request) %>"> <button class="button is-medium is-info is-fullwidth">PhoneBlock-Account erstellen</button> </a> </div> @@ -157,7 +157,7 @@ <p> Das Passwort<%if (token == null) {%>, - das Du bei der <a href="<%=request.getContextPath() %>/signup.jsp">Registrierung</a> erhalten + das Du bei der <a href="<%=request.getContextPath() %>/signup.jsp<%= LoginServlet.locationParamFirst(request) %>">Registrierung</a> erhalten hast, <%} else {%> <code id="passwd2"><%= JspUtil.quote(token) %></code> <a id="passwd2_" title="In die Zwischenablage kopieren." href="#" class="copyToClipboard"><i class="fa-solid fa-copy"></i></a>,<%}%> muss Du jetzt noch in das Feld <i>Passwort</i> in dem Formular in der Fritz!Box eintragen. </p> diff --git a/phoneblock/src/main/webapp/signup-code.jsp b/phoneblock/src/main/webapp/signup-code.jsp index 98de5a4f..40238345 100644 --- a/phoneblock/src/main/webapp/signup-code.jsp +++ b/phoneblock/src/main/webapp/signup-code.jsp @@ -71,14 +71,14 @@ %> <p class="help is-danger"> <%= JspUtil.quote(request.getAttribute("message")) %> - <a href="<%=request.getContextPath()%>/signup.jsp">Nochmal probieren</a>. + <a href="<%=request.getContextPath()%>/signup.jsp<%= LoginServlet.locationParamFirst(request) %>">Nochmal probieren</a>. </p> <% } else { %> <p class="help is-info"> Keine E-Mail erhalten? Prüfe bitte Deinen Spam-Ordner! - <a href="<%=request.getContextPath()%>/signup.jsp">Nochmal probieren</a>. + <a href="<%=request.getContextPath()%>/signup.jsp<%= LoginServlet.locationParamFirst(request) %>">Nochmal probieren</a>. </p> <% } diff --git a/phoneblock/src/main/webapp/signup.jsp b/phoneblock/src/main/webapp/signup.jsp index 7b1e73fe..31da8058 100644 --- a/phoneblock/src/main/webapp/signup.jsp +++ b/phoneblock/src/main/webapp/signup.jsp @@ -1,4 +1,5 @@ <!DOCTYPE html> +<%@page import="de.haumacher.phoneblock.app.SettingsServlet"%> <%@page import="java.net.URLEncoder"%> <%@page import="de.haumacher.phoneblock.app.LoginServlet"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" session="false"%> @@ -29,13 +30,15 @@ </div> <% - String location = LoginServlet.location(request); - String locationParam = LoginServlet.locationParam(request); - String locationParamFirst = LoginServlet.locationParamFirst(request); + String location = LoginServlet.location(request, SettingsServlet.PATH); + String locationParam = LoginServlet.locationParam(location); + String locationParamFirst = LoginServlet.locationParamFirst(location); %> <nav class="panel"> - <p class="panel-heading"><a href="<%=request.getContextPath()%>/oauth/login?force_client=<%=PhoneBlockConfigFactory.GOOGLE_CLIENT%>"><i class="fa-brands fa-google"></i> <span>Mit Google registrieren</span></a></p> + <p class="panel-heading"> + <a href="<%=request.getContextPath()%>/oauth/login<%=locationParamFirst%>&force_client=<%=PhoneBlockConfigFactory.GOOGLE_CLIENT%>"><i class="fa-brands fa-google"></i> <span>Mit Google registrieren</span></a> + </p> </nav> <% diff --git a/phoneblock/src/main/webapp/support-banktransfer.jsp b/phoneblock/src/main/webapp/support-banktransfer.jsp index ba7a3536..91e79f2e 100644 --- a/phoneblock/src/main/webapp/support-banktransfer.jsp +++ b/phoneblock/src/main/webapp/support-banktransfer.jsp @@ -31,7 +31,7 @@ <li>Empfänger: <code id="receiver">${bank.receiver}</code> <a id="receiver_" title="In die Zwischenablage kopieren." href="#" class="copyToClipboard"><i class="fa-solid fa-copy"></i></a></li> <li>Kontonummer: <code id="account">${bank.account}</code> <a id="account_" title="In die Zwischenablage kopieren." href="#" class="copyToClipboard"><i class="fa-solid fa-copy"></i></a></li> <li>BIC: <code id="bic">${bank.bic}</code> <a id="bic_" title="In die Zwischenablage kopieren." href="#" class="copyToClipboard"><i class="fa-solid fa-copy"></i></a></li> - <li>Verwendungszweck: <code id="purpose">PhoneBlock-<%= LoginFilter.getAuthenticatedUser(request.getSession())%></code> <a id="purpose_" title="In die Zwischenablage kopieren." href="#" class="copyToClipboard"><i class="fa-solid fa-copy"></i></a></li> + <li>Verwendungszweck: <code id="purpose">PhoneBlock-<%= LoginFilter.getAuthenticatedUser(request.getSession()).substring(0, 13)%></code> <a id="purpose_" title="In die Zwischenablage kopieren." href="#" class="copyToClipboard"><i class="fa-solid fa-copy"></i></a></li> </ul> <p> diff --git a/phoneblock/src/main/webapp/support.jsp b/phoneblock/src/main/webapp/support.jsp index 6dc24464..cb7f4bd5 100644 --- a/phoneblock/src/main/webapp/support.jsp +++ b/phoneblock/src/main/webapp/support.jsp @@ -1,4 +1,5 @@ <!DOCTYPE html> +<%@page import="de.haumacher.phoneblock.app.LoginFilter"%> <%@page import="de.haumacher.phoneblock.app.LoginServlet"%> <%@page import="de.haumacher.phoneblock.app.SettingsServlet"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" session="false"%> @@ -30,19 +31,31 @@ Betrag aus. Schön wäre, wenn Du <b>1€ pro Jahr</b> oder <b>0,01€ pro abgefangenem Spam-Anruf</b> als Beitrag bezahlst, die Höhe bleibt aber Dir überlassen. </p> +<% + String userName = LoginFilter.getAuthenticatedUser(request.getSession(false)); +%> <div class="tile is-ancestor"> <div class="tile is-parent is-12"> <a class="tile is-child notification is-primary" href="http://paypal.me/phoneblock" target="_blank"> - <p class="title"> + <div class="title"> <span class="icon"> <i class="fa-brands fa-paypal"></i> </span> <span>Mit PayPal spenden</span> - </p> + </div> <p class="subtitle"> Nutze "Geld an Freunde senden", PayPal berechnet ansonsten absurde Gebühren, bei 1€ kommen nur 60Ct an. </p> +<% if (userName == null) { %> + <p class="subtitle"> + Gib bitte die ersten paar Zeichen deines Nutzernamens mit als Nachricht ein, damit ich die Zahlung zuordnen kann. + </p> +<% } else { %> + <p class="subtitle"> + Bitte gibt <code id="purpose">PhoneBlock-<%= userName.substring(0, 13)%></code><spam id="purpose_" title="In die Zwischenablage kopieren." href="#" class="copyToClipboard"><i class="fa-solid fa-copy"></i></spam> mit als Nachricht ein, damit ich die Zahlung zuordnen kann. + </p> +<% } %> </a> </div> </div>