Commit 6a4d2c23 by Juho Salli

Merge branch 'assykorjailuja' into 'master'

Assykorjailuja

pikafixei

See merge request !226
2 parents 25e294c8 9ce826bb
...@@ -101,7 +101,16 @@ public class BarcodeBean implements BarcodeBeanLocal { ...@@ -101,7 +101,16 @@ public class BarcodeBean implements BarcodeBeanLocal {
@Override @Override
public String getUserLongTextCode(EventUser user) { public String getUserLongTextCode(EventUser user) {
return getUserTextCode(user,38,16);
String textcode = getUserTextCode(user, 38, 16);
EventUser user2 = getUserFromLongTextCode(textcode);
if(!user.equals(user2))
throw new RuntimeException("Koodigenerointivirhe"); // TODO: use seculogger or something
return textcode;
} }
@Override @Override
...@@ -112,12 +121,19 @@ public class BarcodeBean implements BarcodeBeanLocal { ...@@ -112,12 +121,19 @@ public class BarcodeBean implements BarcodeBeanLocal {
textcode = textcode.substring(textcode.lastIndexOf("=")+1); textcode = textcode.substring(textcode.lastIndexOf("=")+1);
} }
return getUserFromTextCode(textcode,38,16); return getUserFromTextCode(textcode, 38, 16);
} }
@Override @Override
public String getUserTextCode(EventUser user) { public String getUserTextCode(EventUser user) {
return getUserTextCode(user, 12, 5); String textcode = getUserTextCode(user, 12, 5);
EventUser user2 = getUserFromTextCode(textcode);
if(!user.equals(user2))
throw new RuntimeException("Koodigenerointivirhe");
return textcode;
} }
...@@ -174,11 +190,15 @@ public class BarcodeBean implements BarcodeBeanLocal { ...@@ -174,11 +190,15 @@ public class BarcodeBean implements BarcodeBeanLocal {
BigInteger numbercode = textcodeToNumber(textcode, bytecount); BigInteger numbercode = textcodeToNumber(textcode, bytecount);
String barcode = numbercode.toString(); String barcode = numbercode.toString();
// remove random prefix
int barcodeLenght = 12; int barcodeLenght = 12;
if(lenght < barcodeLenght) if(lenght < barcodeLenght)
barcodeLenght = lenght; barcodeLenght = lenght;
while(barcode.length() < lenght) {
barcode = "0"+barcode;
}
// remove some random -stuff to start of string // remove some random -stuff to start of string
for (int i = lenght - barcodeLenght; i > 0; --i) { for (int i = lenght - barcodeLenght; i > 0; --i) {
......
<?xml version='1.0' encoding='UTF-8' ?> gitla<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui">
......
...@@ -109,6 +109,15 @@ public class InviteAcceptView extends GenericCDIView { ...@@ -109,6 +109,15 @@ public class InviteAcceptView extends GenericCDIView {
public String loginWithExisting() { public String loginWithExisting() {
// email-login also to this view, basicly authView does this, but this acceptInvite... does not
String userlogin = userbean.findUsernameByEmailUsername(username.trim());
if (userlogin != null) {
username = userlogin;
}
EventUser eu = userbean.acceptInviteForExistingUser(username, password, token); EventUser eu = userbean.acceptInviteForExistingUser(username, password, token);
if (eu != null) { if (eu != null) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!