当前位置: 首页>>代码示例>>Java>>正文


Java User.setPassword方法代码示例

本文整理汇总了Java中org.activiti.engine.identity.User.setPassword方法的典型用法代码示例。如果您正苦于以下问题:Java User.setPassword方法的具体用法?Java User.setPassword怎么用?Java User.setPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.identity.User的用法示例。


在下文中一共展示了User.setPassword方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveUser

import org.activiti.engine.identity.User; //导入方法依赖的package包/类
/**
 * 保存User
 *
 * @param redirectAttributes
 * @return
 */
@RequestMapping(value = "user/save", method = RequestMethod.POST)
public String saveUser(@RequestParam("userId") String userId,
                       @RequestParam("firstName") String firstName,
                       @RequestParam("lastName") String lastName,
                       @RequestParam(value = "password", required = false) String password,
                       @RequestParam(value = "email", required = false) String email,
                       RedirectAttributes redirectAttributes) {
    User user = identityService.createUserQuery().userId(userId).singleResult();
    if (user == null) {
        user = identityService.newUser(userId);
    }
    user.setFirstName(firstName);
    user.setLastName(lastName);
    user.setEmail(email);
    if (StringUtils.isNotBlank(password)) {
        user.setPassword(password);
    }
    identityService.saveUser(user);
    redirectAttributes.addFlashAttribute("message", "成功添加用户[" + firstName + " " + lastName + "]");
    return "redirect:/chapter14/identity/user/list";
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:28,代码来源:IdentityController.java

示例2: handlePasswordChange

import org.activiti.engine.identity.User; //导入方法依赖的package包/类
protected void handlePasswordChange() {
  if (passwordField1.getValue() == null || "".equals(passwordField1.getValue().toString())
          || passwordField2.getValue() == null || "".equals(passwordField2.getValue().toString())) {
    errorLabel.setValue(i18nManager.getMessage(Messages.PASSWORD_CHANGE_INPUT_REQUIRED));
  } else if (!passwordField1.getValue().equals(passwordField2.getValue())){
    errorLabel.setValue(i18nManager.getMessage(Messages.PASSWORD_CHANGE_INPUT_MATCH));
  } else {
    String password = passwordField1.getValue().toString();
    // Change data
    User user = identityService.createUserQuery().userId(currentUser.getId()).singleResult();
    user.setPassword(password);
    identityService.saveUser(user);
    
    // Refresh logged in user session data
    ExplorerApp.get().setUser(ExplorerApp.get().getLoginHandler().authenticate(
        user.getId(), user.getPassword()));
    
    // Close popup
    close();
    
    // Show notification
    ExplorerApp.get().getNotificationManager().showInformationNotification(Messages.PASSWORD_CHANGED_NOTIFICATION);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:25,代码来源:ChangePasswordPopupWindow.java

示例3: submitForm

import org.activiti.engine.identity.User; //导入方法依赖的package包/类
@RequestMapping(method=RequestMethod.POST)
public RedirectView submitForm(Model model, @ModelAttribute LoginForm signupForm, BindingResult bindingResult){
	model.addAttribute("signupForm", signupForm);
	RedirectView redirectView = new RedirectView();
	redirectView.setContextRelative(true);
	
	if(bindingResult.hasErrors()) {
		signupForm = new LoginForm();
		redirectView.setUrl("/ocs/signup");
		references(model);
		model.addAttribute("signupForm", signupForm);
	} else{
		loginService.addAccount(signupForm);
		IdentityService identityService = processEngine.getIdentityService();
	    User user = identityService.newUser(signupForm.getUsername());
	    user.setPassword(signupForm.getPassword());
	    identityService.saveUser(user);
	    
	    try{
	    	identityService.saveGroup(identityService.newGroup("payor"));
			identityService.saveGroup(identityService.newGroup("shipper"));
			identityService.saveGroup(identityService.newGroup("shopper"));
			identityService.saveGroup(identityService.newGroup("buyer"));
	    }catch(Exception e){
	    	System.out.println("Groups already exists....");
	    }
	   
	    identityService.createMembership(signupForm.getUsername(), "shopper");
	    identityService.createMembership(signupForm.getUsername(), "buyer");
	    identityService.createMembership(signupForm.getUsername(), "payor");
	    identityService.createMembership(signupForm.getUsername(), "shipper");
	      		
		redirectView.setUrl("/ocs/login");
		
	}
	return redirectView;
}
 
开发者ID:PacktPublishing,项目名称:Spring-MVC-Blueprints,代码行数:38,代码来源:SignUpController.java

示例4: createUser

import org.activiti.engine.identity.User; //导入方法依赖的package包/类
protected void createUser(String userId, String firstName, String lastName, String password, 
        String email, String imageResource, List<String> groups, List<String> userInfo) {
  
  if (identityService.createUserQuery().userId(userId).count() == 0) {
    
    // Following data can already be set by demo setup script
    
    User user = identityService.newUser(userId);
    user.setFirstName(firstName);
    user.setLastName(lastName);
    user.setPassword(password);
    user.setEmail(email);
    identityService.saveUser(user);
    
    if (groups != null) {
      for (String group : groups) {
        identityService.createMembership(userId, group);
      }
    }
  }
  
  // Following data is not set by demo setup script
    
  // image
  if (imageResource != null) {
    byte[] pictureBytes = IoUtil.readInputStream(this.getClass().getClassLoader().getResourceAsStream(imageResource), null);
    Picture picture = new Picture(pictureBytes, "image/jpeg");
    identityService.setUserPicture(userId, picture);
  }
    
  // user info
  if (userInfo != null) {
    for(int i=0; i<userInfo.size(); i+=2) {
      identityService.setUserInfo(userId, userInfo.get(i), userInfo.get(i+1));
    }
  }
  
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:39,代码来源:DemoDataGenerator.java

示例5: createUser

import org.activiti.engine.identity.User; //导入方法依赖的package包/类
protected User createUser() {
  User user = identityService.newUser(form.getField("id").getValue().toString());
  user.setPassword(form.getField("password").getValue().toString());
  if (form.getField("firstName").getValue() != null) {
    user.setFirstName(form.getField("firstName").getValue().toString());
  }
  if (form.getField("lastName").getValue() != null) {
    user.setLastName(form.getField("lastName").getValue().toString());
  }
  if (form.getField("email").getValue() != null) {
    user.setEmail(form.getField("email").getValue().toString());
  }
  identityService.saveUser(user);
  return user;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:16,代码来源:NewUserPopupWindow.java

示例6: testAuthentication

import org.activiti.engine.identity.User; //导入方法依赖的package包/类
public void testAuthentication() {
  User user = identityService.newUser("johndoe");
  user.setPassword("xxx");
  identityService.saveUser(user);

  assertTrue(identityService.checkPassword("johndoe", "xxx"));
  assertFalse(identityService.checkPassword("johndoe", "invalid pwd"));

  identityService.deleteUser("johndoe");
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:11,代码来源:IdentityTest.java


注:本文中的org.activiti.engine.identity.User.setPassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。