Browse Source

Merge branch 'main' into lang_de

lang_de
Stephan Richter 6 months ago
parent
commit
8cd0da60c5
  1. 2
      pom.xml
  2. 5
      src/main/java/de/srsoftware/widerhall/data/User.java
  3. 13
      src/main/java/de/srsoftware/widerhall/web/Web.java
  4. 2
      static/templates/footer.st

2
pom.xml

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
<groupId>org.example</groupId>
<artifactId>Widerhall</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
<build>
<plugins>
<plugin>

5
src/main/java/de/srsoftware/widerhall/data/User.java

@ -137,6 +137,11 @@ public class User { @@ -137,6 +137,11 @@ public class User {
Database.open().query(sql).compile().run();
}
public void dropPasswordToken() throws SQLException {
Database.open().update(TABLE_NAME).set(RESET_TOKEN,null).where(EMAIL,email).compile().run();
}
/**
* Withdraw a specific permission from the user object.
* Updated permission flag will be written to db.

13
src/main/java/de/srsoftware/widerhall/web/Web.java

@ -372,14 +372,17 @@ public class Web extends TemplateServlet { @@ -372,14 +372,17 @@ public class Web extends TemplateServlet {
case RESET_PASSWORD:
if (!isGet) return resetPassword(req,resp);
// TODO: move following code into resetPassword method
try {
user = User.byToken(req.getParameter(TOKEN));
if (user != null) {
var token = req.getParameter(TOKEN);
if (token != null){
try {
user = User.byToken(req.getParameter(TOKEN));
if (user == null) return loadTemplate(path,Map.of(ERROR,t("Failed to find user for token!")),resp);
user.dropPasswordToken();
req.getSession().setAttribute("user",user);
return redirectTo(NEW_PASSWORD_FORM,resp);
} catch (SQLException sqle){
return loadTemplate(path,Map.of(ERROR,t("Failed to add user for token!")),resp);
}
} catch (SQLException sqle){
return loadTemplate(path,Map.of(ERROR,t("Failed to find user for token!")),resp);
}
var email = req.getParameter(EMAIL);
return loadTemplate(path,email == null ? null : Map.of(EMAIL,email),resp);

2
static/templates/footer.st

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<div class="footer">
Widerhall Mail-Verteiler.
Version 1.0.3.
Version 1.0.4.
Hol dir den Quellcode auf <a target="_blank" href="https://git.srsoftware.de/StephanRichter/Widerhall/src/branch/lang_de">git.srsoftware.de</a>
</div>

Loading…
Cancel
Save