</target>
<target name="update-effective-tlds">
<mkdir dir="bin/club/wpia/gigi/util"/>
- <exec executable="wget" dir="bin/club/wpia/gigi/util">
- <arg value="-N"/>
- <arg value="-q"/>
- <arg value="https://publicsuffix.org/list/effective_tld_names.dat"/>
- </exec>
+ <copy file="/usr/share/publicsuffix/effective_tld_names.dat" tofile="bin/club/wpia/gigi/util/effective_tld_names.dat"/>
</target>
</project>
Section: java
Priority: optional
Maintainer: unknown <software@wpia.club>
-Build-Depends: debhelper (>= 8.0.0), dh-systemd, java7-sdk-headless, ant, wget
+Build-Depends: debhelper (>= 8.0.0), dh-systemd, java7-sdk-headless, ant, wget, publicsuffix
Standards-Version: 3.9.4
Homepage: https://wpia.club
#Vcs-Git: git://git.debian.org/collab-maint/gigi.git
setPassword(newPass);
}
- private void setPassword(String newPass) throws GigiApiException {
+ public void setPassword(String newPass) throws GigiApiException {
Name[] names = getNames();
TreeSet<String> nameParts = new TreeSet<>();
for (int i = 0; i < names.length; i++) {
import club.wpia.gigi.output.template.Form;
import club.wpia.gigi.output.template.Template;
import club.wpia.gigi.output.template.TranslateCommand;
+import club.wpia.gigi.pages.LoginPage;
+import club.wpia.gigi.util.AuthorizationContext;
public class ChangeForm extends Form {
private User target;
+ private AuthorizationContext c;
+
public ChangeForm(HttpServletRequest hsr, User target) {
super(hsr);
this.target = target;
+ c = LoginPage.getAuthorizationContext(hsr);
}
private static final Template t = new Template(ChangePasswordPage.class.getResource("ChangePasswordForm.templ"));
@Override
public void outputContent(PrintWriter out, Language l, Map<String, Object> vars) {
+ if ( !c.isStronglyAuthenticated()) {
+ vars.put("currentLoginMethod", "pw");
+ }
t.output(out, l, vars);
}
String p1 = req.getParameter("pword1");
String p2 = req.getParameter("pword2");
GigiApiException error = new GigiApiException();
- if (oldpassword == null || p1 == null || p2 == null) {
+ if ((oldpassword == null && !c.isStronglyAuthenticated()) || p1 == null || p2 == null) {
throw new GigiApiException("All fields are required.");
}
if ( !p1.equals(p2)) {
throw new GigiApiException("New passwords do not match.");
}
try {
- target.changePassword(oldpassword, p1);
+ if (c.isStronglyAuthenticated()) {
+ target.setPassword(p1);
+ } else {
+ target.changePassword(oldpassword, p1);
+ }
target.writeUserLog(target, "User triggered password reset");
} catch (GigiApiException e) {
error.mergeInto(e);
</tr>
</thead>
<tbody>
+ <? if($currentLoginMethod){ ?>
<tr>
<td><?=_Old Password?>: </td>
<td><input class="form-control" type="password" name="oldpassword" required></td>
</tr>
+ <? } ?>
<tr>
<td><?=_New Password?><span class="formMandatory">*</span>: </td>
<td><input class="form-control" type="password" name="pword1" required></td>
import javax.servlet.http.HttpServletRequest;
import club.wpia.gigi.GigiApiException;
+import club.wpia.gigi.dbObjects.Name;
import club.wpia.gigi.dbObjects.Organisation;
import club.wpia.gigi.dbObjects.Organisation.Affiliation;
import club.wpia.gigi.dbObjects.User;
return false;
}
Affiliation aff = iter.next();
- vars.put("name", aff.getTarget().getPreferredName());
+ Name n = aff.getTarget().getPreferredName();
+ vars.put("name", n);
+ vars.put("nameString", n.toString());
vars.put("master", aff.isMaster() ? l.getTranslation("Master") : "");
vars.put("e-mail", aff.getTarget().getEmail());
return true;
<td><?=$name?></td>
<td><?=$e-mail?></td>
<td><?=$master?></td>
- <td><button class="btn btn-warning btn-confirm" data-confirm="<?=_Do you really want to delete the affiliation of ${name} (${e-mail}) to this organisation??>" data-reply="<?=_Cancel?>,<?=_Delete?>" type="submit" name="del" value="<?=$e-mail?>">X</button> </td>
+ <td><button class="btn btn-warning btn-confirm" data-confirm="<?=_Do you really want to delete the affiliation of ${nameString} (${e-mail}) to this organisation??>" data-reply="<?=_Cancel?>,<?=_Delete?>" type="submit" name="del" value="<?=$e-mail?>">X</button>
+ </td>
</tr>
<? } ?>
<tr>
}
+ @Test
+ public void testChangePasswordCertLogin() throws IOException, GigiApiException {
+ // no cert login
+ String np = URLEncoder.encode(TEST_PASSWORD + "v1", "UTF-8");
+ String error = executeBasicWebInteraction(cookie, path, "pword1=" + np + "&pword2=" + np);
+ assertNotNull(error);
+
+ // cert login
+ cookie = cookieWithCertificateLogin(u);
+ error = executeBasicWebInteraction(cookie, path, "pword1=" + np + "&pword2=" + np);
+ assertNull(error);
+
+ cookie = login(u.getEmail(), TEST_PASSWORD);
+ loginCertificate = null;
+ }
}