git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@901 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
allo 20 years ago
parent 6a72f06c40
commit 5605cc8018

@ -163,7 +163,9 @@ public class User_p {
entry = sb.userDB.getEntry(username);
if(entry != null){
try{
entry.setProperty(userDB.Entry.MD5ENCODED_USERPWD_STRING, serverCodings.encodeMD5Hex(username+":"+pw));
if(! pw.equals("")){
entry.setProperty(userDB.Entry.MD5ENCODED_USERPWD_STRING, serverCodings.encodeMD5Hex(username+":"+pw));
}
entry.setProperty(userDB.Entry.USER_FIRSTNAME, firstName);
entry.setProperty(userDB.Entry.USER_LASTNAME, lastName);
entry.setProperty(userDB.Entry.USER_ADDRESS, address);

@ -9,7 +9,7 @@
<meta name="copyright" content="Michael Christen">
<base href="http://#[host]#:#[port]#/">
<link rel="stylesheet" media="all" href="/env/style.css">
<link rel="stylesheet" media="all" href="http://#[host]#:#[port]#/env/style.css">
<!-- (C), Architecture and Realisation: Michael Peter Christen; Contact: mc <at> anomic.de -->
@ -21,7 +21,7 @@
<tr height="36">
<td width="240">
<a href="http://www.yacy.net">
<img width="52" height="33" border="0" src="/env/grafics/yacy.gif" align="top">
<img width="52" height="33" border="0" src="http://#[host]#:#[port]#//env/grafics/yacy.gif" align="top">
</a>
</td>
<td width="50%" align="center">
@ -55,6 +55,8 @@
Could not load resource. The file is not available.
::<!-- 4 -->
#[detailedErrorMsg]#
::<!-- 5 -->
Your Internet-Timelimit is reached.
#(/errorMessageType)#
</b>
</p>

@ -240,19 +240,30 @@ public final class userDB {
return (this.mem.containsKey(LAST_ACCESS)?Long.valueOf((String)this.mem.get(LAST_ACCESS)):null);
}
public long updateLastAccess(long timeStamp, boolean decrementTimeUsed) {
public boolean canSurf(){
if(this.updateLastAccess(true) < this.getTimeLimit().longValue() )
return true;
else
return false;
}
public long updateLastAccess(boolean incrementTimeUsed) {
return updateLastAccess(System.currentTimeMillis(), incrementTimeUsed);
}
public long updateLastAccess(long timeStamp, boolean incrementTimeUsed) {
if (timeStamp < 0) throw new IllegalArgumentException();
Long lastAccess = this.getLastAccess();
long oldTimeUsed = getTimeUsed();
long newTimeUsed = oldTimeUsed;
if (decrementTimeUsed) {
if (incrementTimeUsed) {
if ((lastAccess == null)||((lastAccess != null)&&(timeStamp-lastAccess.longValue()>=1000*60))) {
this.mem.put(TIME_USED,Long.toString(newTimeUsed = ++oldTimeUsed));
this.mem.put(LAST_ACCESS,Long.toString(timeStamp)); //update Timestamp
}
}
this.mem.put(LAST_ACCESS,Long.toString(timeStamp));
}else{
this.mem.put(LAST_ACCESS,Long.toString(timeStamp)); //update Timestamp
}
try {
userDB.this.userTable.set(getUserName(), this.mem);

@ -323,7 +323,12 @@ public final class httpd implements serverHandler {
userDB.Entry entry=switchboard.userDB.getEntry(tmp[0]);
if( entry != null && entry.getMD5EncodedUserPwd().equals(serverCodings.encodeMD5Hex(auth)) ){
//TODO: Check Timelimits
return true;
if(entry.canSurf()){
return true;
} else {
sendRespondError(this.prop,this.session.out,5,403,null, "Internet-Timelimit reached", null);
return false;
}
}
}
// ask for authenticate
@ -332,14 +337,6 @@ public final class httpd implements serverHandler {
this.session.out.write((httpHeader.CONTENT_LENGTH + ": 0\r\n").getBytes());
this.session.out.write("\r\n".getBytes());
return false;
// if (!this.proxyAccountBase64MD5.equals(serverCodings.encodeMD5Hex(auth.trim().substring(6)))) {
// // ask for authenticate
// this.session.out.write((httpVersion + " 407 Proxy Authentication Required" + serverCore.crlfString +
// httpHeader.PROXY_AUTHENTICATE + ": Basic realm=\"log-in\"" + serverCore.crlfString).getBytes());
// this.session.out.write((httpHeader.CONTENT_LENGTH + ": 0\r\n").getBytes());
// this.session.out.write("\r\n".getBytes());
// return false;
// }
}else{
return true;
}

Loading…
Cancel
Save