Skip to content
Snippets Groups Projects
Commit 93d2681f authored by Michael Simon's avatar Michael Simon
Browse files

Merge branch 'feature/ISSUE-205_ssh-key-deletion-bugged-2' into 'main'

Resolve "SSH key deletion bugged"

Closes #205

See merge request !82
parents 71de4f5c 97e4f79c
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,10 @@ import edu.kit.scc.webreg.service.identity.IdentityService;
import edu.kit.scc.webreg.service.ssh.SshPubKeyService;
import edu.kit.scc.webreg.session.SessionManager;
import edu.kit.scc.webreg.util.FacesMessageGenerator;
import java.io.IOException;
import jakarta.faces.context.ExternalContext;
import jakarta.faces.context.FacesContext;
import jakarta.servlet.http.HttpServletRequest;
@Named
@ViewScoped
......@@ -92,7 +96,7 @@ public class UserSshKeyManagementBean implements Serializable {
keyList.remove(k);
sshPubKeyService.deleteKey(k.getPubKeyEntity(), "identity-" + identity.getId());
});
messageGenerator.addResolvedInfoMessage("info", "ssh_keys.key_deleted", false);
messageGenerator.addResolvedInfoMessage("info", "ssh_keys.key_deleted", true);
}
public void deployKey() {
......@@ -125,12 +129,17 @@ public class UserSshKeyManagementBean implements Serializable {
newKey = "";
newName = "";
messageGenerator.addResolvedInfoMessage("info", "ssh_key_deployed", true);
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
ec.redirect(((HttpServletRequest) ec.getRequest()).getRequestURI());
} catch (UnsupportedKeyTypeException e) {
logger.warn("An error occured whilst deploying key: " + e.getMessage());
messageGenerator.addResolvedErrorMessage("sshKeyMessage", "error_msg", e.toString(), false);
} catch (SshPubKeyBlacklistedException e) {
logger.warn("User {} tried to deploy blacklisted key", identity.getId());
messageGenerator.addResolvedErrorMessage("sshKeyMessage", "error", "key_blacklisted", true);
} catch (IOException e) {
logger.warn("An error occured trying to reload page after deploying key: " + e.getMessage());
messageGenerator.addResolvedErrorMessage("sshKeyMessage", "error_msg", e.toString(), false);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment