forked from External/mage
Added chat mute and user (de)activation actions to the Mage server console.
This commit is contained in:
parent
7c4b40073c
commit
c46f75ac28
18 changed files with 511 additions and 213 deletions
|
|
@ -1,20 +1,22 @@
|
|||
package mage.server;
|
||||
|
||||
import com.j256.ormlite.field.DataType;
|
||||
import com.j256.ormlite.field.DatabaseField;
|
||||
import com.j256.ormlite.table.DatabaseTable;
|
||||
import java.util.Date;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
import org.apache.shiro.authc.SimpleAuthenticationInfo;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
|
||||
import org.apache.shiro.util.ByteSource;
|
||||
import org.apache.shiro.codec.Base64;
|
||||
import org.apache.shiro.crypto.hash.Hash;
|
||||
import org.apache.shiro.util.ByteSource;
|
||||
|
||||
@DatabaseTable(tableName = "authorized_user")
|
||||
public class AuthorizedUser {
|
||||
|
||||
@DatabaseField(indexName = "name_index", unique = true)
|
||||
@DatabaseField(id = true, indexName = "name_index", unique = true)
|
||||
protected String name;
|
||||
|
||||
@DatabaseField
|
||||
|
|
@ -32,6 +34,18 @@ public class AuthorizedUser {
|
|||
@DatabaseField(indexName = "email_index", unique = true)
|
||||
protected String email;
|
||||
|
||||
@DatabaseField
|
||||
protected boolean active; // the user can't sign in
|
||||
|
||||
@DatabaseField(dataType = DataType.DATE_STRING, format = "yyyy-MM-dd HH:mm:ss")
|
||||
protected Date lockedUntil; // the user can't sign in until timestamp
|
||||
|
||||
@DatabaseField(dataType = DataType.DATE_STRING, format = "yyyy-MM-dd HH:mm:ss")
|
||||
protected Date chatLockedUntil; // the user can't use the chat until timestamp
|
||||
|
||||
@DatabaseField(dataType = DataType.DATE_STRING, format = "yyyy-MM-dd HH:mm:ss")
|
||||
protected Date lastConnection; // time of the last user connect
|
||||
|
||||
public AuthorizedUser() {
|
||||
}
|
||||
|
||||
|
|
@ -42,6 +56,9 @@ public class AuthorizedUser {
|
|||
this.hashAlgorithm = hash.getAlgorithmName();
|
||||
this.hashIterations = hash.getIterations();
|
||||
this.email = email;
|
||||
this.chatLockedUntil = null;
|
||||
this.active = true;
|
||||
this.lockedUntil = null;
|
||||
}
|
||||
|
||||
public boolean doCredentialsMatch(String name, String password) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue