Package models

Examples of models.User$UserMapper


        String servletPath = request.getServletPath();
        HttpSession session = request.getSession();
        if(servletPath.equals("/auctions/bid")) {

            User u = (User) session.getAttribute("user");
            String bid = request.getParameter("bid");
            Integer id = new Integer(request.getParameter("id"));
            Auction a = Auction.getById(id);
            a.setLastPrice(new Float(bid));
            a.setLastUserId(u.getId());
            a.update();

            response.sendRedirect(request.getContextPath());
       
        }
        else if(servletPath.equals("/auctions/save"))
        {
     
                            User u = (User) session.getAttribute("user");
                            Auction auction = new Auction();

        MultipartRequest multi = new MultipartRequest(request, "/home/buzz/NetBeansProjects/bweb/web/images/");

                                auction.setProduct(multi.getParameter("newProduct"));

                                auction.setCatId(new Integer(multi.getParameter("newCat")));

                                File f = multi.getFile("newImage");

                                String fileName = multi.getFilesystemName("newImage");

        auction.setPhoto(fileName);

                                auction.setStartingPrice(new Float (multi.getParameter("newStartingPrice")));
        auction.setLastPrice(new Float (multi.getParameter("newStartingPrice")));
                                auction.setMinPrice( new Float (multi.getParameter("newMinPrice")));

                                Integer duration,i = new Integer(multi.getParameter("newDuration"));
                                if(i == 1) duration = 4;
                                else if(i == 2) duration = 6;
                                else duration = 10;

                                Calendar cal = Calendar.getInstance();
                                cal.add(Calendar.DAY_OF_YEAR, duration );
                                Long e = (cal.getTimeInMillis());
                                java.sql.Date expire = new java.sql.Date(e);
                                auction.setExpire(expire);

                                auction.setShipping(multi.getParameter("newShip"));

                                auction.setUserId(u.getId());
                                auction.setLastPrice(null);
                                auction.setLastUserId(null);
                                auction.setDescription(multi.getParameter("newDesc"));

                                auction.save();
View Full Code Here


      flash(Application.FLASH_MESSAGE_KEY,
          Messages.get(
              "playauthenticate.reset_password.message.instructions_sent",
              email));

      final User user = User.findByEmail(email);
      if (user != null) {
        // yep, we have a user with this email that is active - we do
        // not know if the user owning that account has requested this
        // reset, though.
        final MyUsernamePasswordAuthProvider provider = MyUsernamePasswordAuthProvider
View Full Code Here

      final TokenAction ta = tokenIsValid(token, Type.PASSWORD_RESET);
      if (ta == null) {
        return badRequest(no_token_or_invalid.render());
      }
      final User u = ta.targetUser;
      try {
        // Pass true for the second parameter if you want to
        // automatically create a password and the exception never to
        // happen
        u.resetPassword(new MyUsernamePasswordAuthUser(newPassword),
            false);
      } catch (final RuntimeException re) {
        flash(Application.FLASH_MESSAGE_KEY,
            Messages.get("playauthenticate.reset_password.message.no_password_account"));
      }
View Full Code Here

    return ok(index.render());
  }

  public static User getLocalUser(final Session session) {
    final AuthUser currentAuthUser = PlayAuthenticate.getUser(session);
    final User localUser = User.findByAuthUserIdentity(currentAuthUser);
    return localUser;
  }
View Full Code Here

    return localUser;
  }

  @Restrict(@Group(Application.USER_ROLE))
  public static Result restricted() {
    final User localUser = getLocalUser(session());
    return ok(restricted.render(localUser));
  }
View Full Code Here

    return ok(restricted.render(localUser));
  }

  @Restrict(@Group(Application.USER_ROLE))
  public static Result profile() {
    final User localUser = getLocalUser(session());
    return ok(profile.render(localUser));
  }
View Full Code Here

    return LOGIN_FORM;
  }

  @Override
  protected com.feth.play.module.pa.providers.password.UsernamePasswordAuthProvider.SignupResult signupUser(final MyUsernamePasswordAuthUser user) {
    final User u = User.findByUsernamePasswordIdentity(user);
    if (u != null) {
      if (u.emailValidated) {
        // This user exists, has its email validated and is active
        return SignupResult.USER_EXISTS;
      } else {
        // this user exists, is active but has not yet validated its
        // email
        return SignupResult.USER_EXISTS_UNVERIFIED;
      }
    }
    // The user either does not exist or is inactive - create a new one
    @SuppressWarnings("unused")
    final User newUser = User.create(user);
    // Usually the email should be verified before allowing login, however
    // if you return
    // return SignupResult.USER_CREATED;
    // then the user gets logged in directly
View Full Code Here

  }

  @Override
  protected com.feth.play.module.pa.providers.password.UsernamePasswordAuthProvider.LoginResult loginUser(
      final MyLoginUsernamePasswordAuthUser authUser) {
    final User u = User.findByUsernamePasswordIdentity(authUser);
    if (u == null) {
      return LoginResult.NOT_FOUND;
    } else {
      if (!u.emailValidated) {
        return LoginResult.USER_UNVERIFIED;
View Full Code Here

@Security.Authenticated(Secured.class)
public class Restricted extends Controller {

  public static Result index() {
    final User localUser = Application.getLocalUser(session());
    return ok(restricted.render(localUser));
  }
View Full Code Here

        "You need to accept the OAuth connection in order to use this website!");
    return redirect(routes.Application.index());
  }

  public static User getLocalUser(final Session session) {
    final User localUser = User.findByAuthUserIdentity(PlayAuthenticate
        .getUser(session));
    return localUser;
  }
View Full Code Here

TOP

Related Classes of models.User$UserMapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.