本文整理汇总了Java中com.stormpath.sdk.account.Account.setPassword方法的典型用法代码示例。如果您正苦于以下问题:Java Account.setPassword方法的具体用法?Java Account.setPassword怎么用?Java Account.setPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.stormpath.sdk.account.Account
的用法示例。
在下文中一共展示了Account.setPassword方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createUser
import com.stormpath.sdk.account.Account; //导入方法依赖的package包/类
/**
* Create new user account with given username and password
*
* @param givenName given name of user
* @param surname last name of user
* @param email email of user
* @param password password of user
* @return Account instance of new user
* @throws ResourceException
*/
public static Account createUser(String givenName, String surname, String email, String password) throws ResourceException {
Account created = null;
try {
Account account = getStormpathClient().instantiate(Account.class);
account.setGivenName(givenName);
account.setSurname(surname);
account.setEmail(email);
account.setPassword(password);
created = getStormpathApplicaiton().createAccount(account);
} catch (ResourceException ex) {
LOGGER.error("status: {} requestId: {} message: {} ", new Object[] { ex.getStatus(), ex.getRequestId(), ex.getMessage()});
throw ex;
}
return created;
}
示例2: createAccount
import com.stormpath.sdk.account.Account; //导入方法依赖的package包/类
private Account createAccount(final String uname, final String pw) {
// Create the account object
Account account = client.instantiate(Account.class);
// Set the account properties
account.setGivenName("Bob");
account.setSurname("Bobbin");
account.setUsername(uname); // optional, defaults to email if unset
account.setEmail("[email protected]");
account.setPassword(pw);
CustomData cd = account.getCustomData();
cd.put("rank", "Captain");
// Create the account using the existing Application object
return application.createAccount(account);
}
示例3: updateUserPassword
import com.stormpath.sdk.account.Account; //导入方法依赖的package包/类
public final int updateUserPassword(final String userNameIn,
final String passwordIn, final String tokenIn) {
Account acc = null;
Application uApp = getUsersApplication(userNameIn);
if (uApp != null) {
acc = getApplicationByUser(userNameIn).verifyPasswordResetToken(
tokenIn);
}
if (acc == null) {
return -1;
} else {
// check username & acc username agree
boolean namesMatch = userNameIn.equals(acc.getUsername());
if (!namesMatch) {
return -2;
}
if (namesMatch) {
if (stringOK(passwordIn)) {
acc.setPassword(passwordIn);
acc.save();
return 1;
} else {
return 0;
}
}
}
return -3;
}