From 6ff5e60046c3bde241dcaea2c5e75023bd7c6d3e Mon Sep 17 00:00:00 2001 From: Dave Date: Sun, 28 Jun 2015 21:48:00 +0200 Subject: [PATCH] added register constructor method --- src/nodash/core/NoRegister.java | 5 +++++ src/nodash/core/spheres/NoSessionSphere.java | 6 ++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/nodash/core/NoRegister.java b/src/nodash/core/NoRegister.java index ef40d34..500f4f0 100644 --- a/src/nodash/core/NoRegister.java +++ b/src/nodash/core/NoRegister.java @@ -20,4 +20,9 @@ package nodash.core; public final class NoRegister { public byte[] cookie; public byte[] data; + + public NoRegister(byte[] cookie, byte[] data) { + this.cookie = cookie; + this.data = data; + } } diff --git a/src/nodash/core/spheres/NoSessionSphere.java b/src/nodash/core/spheres/NoSessionSphere.java index 25ef007..5f5615c 100644 --- a/src/nodash/core/spheres/NoSessionSphere.java +++ b/src/nodash/core/spheres/NoSessionSphere.java @@ -176,12 +176,11 @@ public final class NoSessionSphere { } public static synchronized NoRegister registerUser(NoUser user, char[] password) { - NoRegister result = new NoRegister(); NoSession session = new NoSession(user); NoSessionSphere.sessions.put(session.uuid, session); - result.cookie = session.getEncryptedUUID(); try { - result.data = NoSessionSphere.save(result.cookie, password); + byte[] cookie = session.getEncryptedUUID(); + return new NoRegister(cookie, NoSessionSphere.save(cookie, password)); } catch (NoDashSessionBadUUIDException e) { throw new NoDashFatalException("Immediately generated cookie throwing bad cookie error.", e); } catch (NoSessionExpiredException e) { @@ -196,6 +195,5 @@ public final class NoSessionSphere { throw new NoDashFatalException( "Session claims to be awaiting confirmation before returning data to the user.", e); } - return result; } }