* Parse and store the user credentials to the appropriate fields.
*/
private boolean parseUserCredentials() {
- username = Window.Location.getParameter("user");
- token = Window.Location.getParameter("token");
Configuration conf = (Configuration) GWT.create(Configuration.class);
Dictionary otherProperties = Dictionary.getDictionary("otherProperties");
- if (username == null || username.length() == 0 || token == null || token.length() == 0) {
- String cookie = otherProperties.get("authCookie");
- String auth = Cookies.getCookie(cookie);
- if (auth == null) {
- authenticateUser();
- return false;
- }
- if (auth.startsWith("\""))
- auth = auth.substring(1);
- if (auth.endsWith("\""))
- auth = auth.substring(0, auth.length() - 1);
- String[] authSplit = auth.split("\\" + conf.cookieSeparator(), 2);
- if (authSplit.length != 2) {
- authenticateUser();
- return false;
- }
- username = authSplit[0];
- token = authSplit[1];
+ String cookie = otherProperties.get("authCookie");
+ String auth = Cookies.getCookie(cookie);
+ if (auth == null) {
+ authenticateUser();
+ return false;
}
- else
- Cookies.setCookie(otherProperties.get("authCookie"), username + conf.cookieSeparator() + token, null, "", "/", false);
+ if (auth.startsWith("\""))
+ auth = auth.substring(1);
+ if (auth.endsWith("\""))
+ auth = auth.substring(0, auth.length() - 1);
+ String[] authSplit = auth.split("\\" + conf.cookieSeparator(), 2);
+ if (authSplit.length != 2) {
+ authenticateUser();
+ return false;
+ }
+ username = authSplit[0];
+ token = authSplit[1];
String gotoUrl = Window.Location.getParameter("goto");
if (gotoUrl != null && gotoUrl.length() > 0) {