Package com.pugh.sockso

Examples of com.pugh.sockso.Validater


     *
     */
   
    private void validateInputFields() throws ValidationException {
   
        final Validater v = new Validater( db );
       
        if ( !v.checkRequiredFields( new JTextComponent[] { txtName, txtPass1, txtEmail }) )
            throw new ValidationException( locale.getString("gui.error.missingField") );
       
        if ( !v.isValidEmail(txtEmail.getText()) )
            throw new ValidationException( locale.getString("gui.error.invalidEmail") );

        String pass1 = new String( txtPass1.getPassword() );
        String pass2 = new String( txtPass2.getPassword() );
        if ( !pass1.equals(pass2) )
            throw new ValidationException( locale.getString("gui.error.passwordsDontMatch") );

        if ( v.usernameExists(txtName.getText()) )
            throw new ValidationException( locale.getString("gui.error.duplicateUsername") );

        if ( v.emailExists(txtEmail.getText()) )
            throw new ValidationException( locale.getString("gui.error.duplicateEmail") );

    }
View Full Code Here


        final String pass1 = req.getArgument( "pass1" );
        final String pass2 = req.getArgument( "pass2" );
        final String email = req.getArgument( "email" ).trim();
       
        final Database db = getDatabase();
        final Validater v = new Validater( db );
       
        if ( !v.checkRequiredFields(new String[]{name,pass1,email}) )
            throw new BadRequestException( locale.getString("www.error.missingField") );
        if ( !pass1.equals(pass2) )
            throw new BadRequestException( locale.getString("www.error.passwordsDontMatch") );
        if ( !v.isValidEmail(email) )
            throw new BadRequestException( locale.getString("www.error.invalidEmail") );
        if ( v.usernameExists(name) )
            throw new BadRequestException( locale.getString("www.error.duplicateUsername") );
        if ( v.emailExists(email) )
            throw new BadRequestException( locale.getString("www.error.duplicateEmail") );

        User newUser = new User( -1, name, pass1, email );
        newUser.setActive( !p.get(Constants.WWW_USERS_REQUIRE_ACTIVATION).equals(Properties.YES) );
        newUser.save( db );
View Full Code Here

        if ( !Files.isValidMimeType(contentType) )
            throw new BadRequestException( locale.getString("www.error.unsupportedAudioFormat") );
       
        // check required fields
        final Database db = getDatabase();
        final Validater v = new Validater( db );
        final String artist = req.getArgument( "artist" );
        final String album = req.getArgument( "album" );
        final String track = req.getArgument( "title" );
        if ( !v.checkRequiredFields( new String[] { artist, album, track }) )
            throw new BadRequestException( locale.getString("www.error.missingField") );

    }
View Full Code Here

    public String execute( final String[] args ) throws SQLException {

        try {

            final Validater v = new Validater( db );
            final String name = args[ 1 ];
            final String pass = args[ 2 ];
            final String email = args[ 3 ];
            final String isAdmin = args[ 4 ];

            if ( v.usernameExists(name) ) {
                throw new ValidationException( locale.getString("con.err.usernameExists") );
            }

            if ( v.emailExists(email) ) {
                throw new ValidationException( locale.getString("con.err.emailExists") );
            }

            final User newUser = new User(
                name,
View Full Code Here

TOP

Related Classes of com.pugh.sockso.Validater

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.