added register constructor method
This commit is contained in:
@@ -20,4 +20,9 @@ package nodash.core;
|
|||||||
public final class NoRegister {
|
public final class NoRegister {
|
||||||
public byte[] cookie;
|
public byte[] cookie;
|
||||||
public byte[] data;
|
public byte[] data;
|
||||||
|
|
||||||
|
public NoRegister(byte[] cookie, byte[] data) {
|
||||||
|
this.cookie = cookie;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,12 +176,11 @@ public final class NoSessionSphere {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized NoRegister registerUser(NoUser user, char[] password) {
|
public static synchronized NoRegister registerUser(NoUser user, char[] password) {
|
||||||
NoRegister result = new NoRegister();
|
|
||||||
NoSession session = new NoSession(user);
|
NoSession session = new NoSession(user);
|
||||||
NoSessionSphere.sessions.put(session.uuid, session);
|
NoSessionSphere.sessions.put(session.uuid, session);
|
||||||
result.cookie = session.getEncryptedUUID();
|
|
||||||
try {
|
try {
|
||||||
result.data = NoSessionSphere.save(result.cookie, password);
|
byte[] cookie = session.getEncryptedUUID();
|
||||||
|
return new NoRegister(cookie, NoSessionSphere.save(cookie, password));
|
||||||
} catch (NoDashSessionBadUUIDException e) {
|
} catch (NoDashSessionBadUUIDException e) {
|
||||||
throw new NoDashFatalException("Immediately generated cookie throwing bad cookie error.", e);
|
throw new NoDashFatalException("Immediately generated cookie throwing bad cookie error.", e);
|
||||||
} catch (NoSessionExpiredException e) {
|
} catch (NoSessionExpiredException e) {
|
||||||
@@ -196,6 +195,5 @@ public final class NoSessionSphere {
|
|||||||
throw new NoDashFatalException(
|
throw new NoDashFatalException(
|
||||||
"Session claims to be awaiting confirmation before returning data to the user.", e);
|
"Session claims to be awaiting confirmation before returning data to the user.", e);
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user