All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fr.smallcrew.security.web.LostPasswordController Maven / Gradle / Ivy

Go to download

Foundation of all smallcrew's projects needing authenticated users and role management

The newest version!
package fr.smallcrew.security.web;

import fr.smallcrew.rest.data.PrimitiveValue;
import fr.smallcrew.security.data.LostPasswordData;
import fr.smallcrew.security.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/lostPassword")
public class LostPasswordController {
  @Autowired
  private UserService userService;

  @RequestMapping(method = RequestMethod.POST)
  public PrimitiveValue lostPassword(HttpServletRequest request, @RequestParam("username") String username) {
    LostPasswordData data = userService.sendLostPasswordMail(username, request.getLocale());
    return PrimitiveValue.from(data.getEmail());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy