public class BSAccountManManImpl extends java.lang.Object implements BSAccountManMan
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
logger |
Constructor and Description |
---|
BSAccountManManImpl() |
Modifier and Type | Method and Description |
---|---|
BSAccount |
getAccount(int userid)
Get a user account, given his BuckoSoft userid
|
BSAccount |
getAccount(java.lang.String username)
Get a user account, given his username (the name he registered with)
|
BSAccount |
getAccountByToken(int token)
Get a user account, given his recover password token
|
BSAccountMan |
getBsAccountMan() |
Database |
getDb() |
java.lang.String |
getLoginSuccessPageRedirect() |
BSAccountUser |
getNewUser()
Return a new user created by the UserFactory
|
BSAccountUserWebSession |
getNewUserWebSession(BSAccountUser user) |
int |
getRandomInt()
Return a random number.
|
BSAccountUser |
getUser(BSAccount account) |
int |
getUserCount()
Get the number of users in the system
|
void |
insertAccount(BSAccount account) |
boolean |
isHelloForwards()
Some apps like to redirect hello.do to home.do if the user is logged in.
|
java.lang.String |
registerAccount(java.lang.String appName,
BSAccount account)
Register a new user to the BSAccount system.
|
java.lang.String |
sendValidateEmail(java.lang.String appName,
java.lang.String username,
java.lang.String email)
"Forgot password" helper method.
|
void |
setBaseUrl(java.lang.String baseUrl)
Set the base Url to prepend to the validate URL
|
void |
setBsAccountMan(BSAccountMan bsAccountMan) |
void |
setDb(Database db) |
void |
setHelloForwards(boolean helloForwards)
Some apps like to redirect hello.do to home.do if the user is logged in.
|
void |
setLoginSuccessPageRedirect(java.lang.String loginSuccessPageRedirect)
Maybe you don't want the default home.do after a successful login.
|
void |
setSmtpHost(java.lang.String smtpHost)
Set the host that will accept our outgoing email
|
void |
setUserFactory(UserFactory userFactory) |
void |
updateAccount(BSAccount account)
Store the account's attributes (excluding password) back to the database.
|
void |
updateAccountPassword(BSAccount account,
java.lang.String newPassword)
Change the user's password
|
java.lang.String |
validateAccount(java.lang.String userid,
java.lang.String registerToken)
After the user clicks on the emailed link, call this function with the two tokens
passed in the url
|
java.lang.String |
validateEmailAddress(java.lang.String email)
Validate this email address, make sure it looks real.
|
java.lang.String |
validateUserName(java.lang.String username)
Validate this username, make sure it has no funny characters.
|
void |
verifyUser(BSAccount account)
After a user has clicked the link in his mail, fill in the rest of the fields, and call this.
|
public BSAccountMan getBsAccountMan()
public void setBsAccountMan(BSAccountMan bsAccountMan)
bsAccountMan
- the bsAccountMan to setpublic void setSmtpHost(java.lang.String smtpHost)
BSAccountManMan
setSmtpHost
in interface BSAccountManMan
smtpHost
- the smtpHost to setpublic void setBaseUrl(java.lang.String baseUrl)
BSAccountManMan
setBaseUrl
in interface BSAccountManMan
baseUrl
- Looks something like "http://mae:8087/SPMCards/"
public Database getDb()
public void setDb(Database db)
db
- the db to setpublic BSAccountUser getNewUser()
BSAccountManMan
getNewUser
in interface BSAccountManMan
public BSAccountUser getUser(BSAccount account)
public BSAccountUserWebSession getNewUserWebSession(BSAccountUser user)
getNewUserWebSession
in interface BSAccountManMan
public int getUserCount()
getUserCount
in interface BSAccountManMan
public void insertAccount(BSAccount account)
public void updateAccount(BSAccount account)
BSAccountManMan
updateAccount
in interface BSAccountManMan
public void updateAccountPassword(BSAccount account, java.lang.String newPassword)
BSAccountManMan
updateAccountPassword
in interface BSAccountManMan
account
- His BSAccountnewPassword
- His new cleartext passwordpublic java.lang.String registerAccount(java.lang.String appName, BSAccount account)
BSAccountManMan
registerAccount
in interface BSAccountManMan
appName
- The application that we want to return to.account
- The user's account. username and email should be filled in before calling this.public void verifyUser(BSAccount account)
BSAccountManMan
verifyUser
in interface BSAccountManMan
account
- The user's account. username, email, and password should be filled in.public java.lang.String validateUserName(java.lang.String username)
BSAccountManMan
validateUserName
in interface BSAccountManMan
username
- The username to checkpublic java.lang.String validateEmailAddress(java.lang.String email)
BSAccountManMan
validateEmailAddress
in interface BSAccountManMan
email
- The email address to checkpublic java.lang.String sendValidateEmail(java.lang.String appName, java.lang.String username, java.lang.String email)
BSAccountManMan
sendValidateEmail
in interface BSAccountManMan
appName
- The application that we want to return to.username
- The username that the guy typed in.email
- The email address that the guy typed in.public java.lang.String validateAccount(java.lang.String userid, java.lang.String registerToken)
BSAccountManMan
validateAccount
in interface BSAccountManMan
userid
- the value of the id=
parameter that was in the urlregisterToken
- The value of the validate=
parameter that was in the url (should be a number)public int getRandomInt()
BSAccountManMan
getRandomInt
in interface BSAccountManMan
public BSAccount getAccount(java.lang.String username)
BSAccountManMan
getAccount
in interface BSAccountManMan
username
- A String that his a namepublic BSAccount getAccount(int userid)
BSAccountManMan
getAccount
in interface BSAccountManMan
userid
- The int that was assigned to him when his record was created.public BSAccount getAccountByToken(int token)
BSAccountManMan
getAccountByToken
in interface BSAccountManMan
token
- The token that was emailed to the lost user.public void setLoginSuccessPageRedirect(java.lang.String loginSuccessPageRedirect)
BSAccountManMan
setLoginSuccessPageRedirect
in interface BSAccountManMan
public java.lang.String getLoginSuccessPageRedirect()
getLoginSuccessPageRedirect
in interface BSAccountManMan
public void setUserFactory(UserFactory userFactory)
setUserFactory
in interface BSAccountManMan
public boolean isHelloForwards()
BSAccountManMan
isHelloForwards
in interface BSAccountManMan
public void setHelloForwards(boolean helloForwards)
BSAccountManMan
setHelloForwards
in interface BSAccountManMan
helloForwards
- the helloForwards to set