]> WPIA git - gigi.git/commitdiff
fix: prompt for confirmation when removing org admins
authorFelix Dörre <felix@dogcraft.de>
Sun, 20 Aug 2017 23:00:28 +0000 (01:00 +0200)
committerFelix Dörre <felix@dogcraft.de>
Thu, 24 Aug 2017 22:17:03 +0000 (00:17 +0200)
Change-Id: I653808751fb3f7ebb8cd65974768fe8614ab72ae

src/club/wpia/gigi/pages/orga/AffiliationForm.java
src/club/wpia/gigi/pages/orga/AffiliationForm.templ

index 58ab93bfecd1a03b257c638674a4f9fd8e688fbc..278e38b7d56b2364d51e30b97191cfffcb46f23a 100644 (file)
@@ -9,8 +9,8 @@ import javax.servlet.http.HttpServletRequest;
 
 import club.wpia.gigi.GigiApiException;
 import club.wpia.gigi.dbObjects.Organisation;
-import club.wpia.gigi.dbObjects.User;
 import club.wpia.gigi.dbObjects.Organisation.Affiliation;
+import club.wpia.gigi.dbObjects.User;
 import club.wpia.gigi.localisation.Language;
 import club.wpia.gigi.output.template.Form;
 import club.wpia.gigi.output.template.IterableDataset;
@@ -38,7 +38,10 @@ public class AffiliationForm extends Form {
             }
         } else if (req.getParameter("do_affiliate") != null) {
             User byEmail = User.getByEmail(req.getParameter("email"));
-            if (byEmail != null && byEmail.canVerify()) {
+            if (byEmail == null) {
+                throw new GigiApiException("To add an admin, the email address is required.");
+            }
+            if (byEmail.canVerify()) {
                 o.addAdmin(byEmail, LoginPage.getUser(req), req.getParameter("master") != null);
                 return new RedirectResult(ViewOrgPage.DEFAULT_PATH + "/" + o.getId());
             } else {
index b44d0bde669813f2ff980fdd2168371832465ceb..6d8c4f2ba38162e685fc637e2f221820309cf668 100644 (file)
     <td><?=$name?></td>
     <td><?=$e-mail?></td>
     <td><?=$master?></td>
-    <td><button class="btn btn-warning" 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 ${e-mail} to this organisation??>" data-reply="<?=_Cancel?>,<?=_Delete?>" type="submit" name="del" value="<?=$e-mail?>">X</button> </td>
   </tr>
 <? } ?>
   <tr>
     <td></td>
-    <td><input class="form-control" type="text" name="email" required></td>
+    <td><input class="form-control" type="text" name="email"></td>
     <td><input type="checkbox" name="master" value="y"></td>
     <td><input class="btn btn-primary" type="submit" name="do_affiliate" value="<?=_Add?>"></td>
   </tr>