Package model.forms

Source Code of model.forms.UserForm

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package model.forms;

import models.data.User;
import play.data.validation.Constraints.*;

/**
*
* @author intelWorX
*/
public class UserForm {

    @Required(message = "E-mail is required")
    @Email(message = "Invalid e-mail supplied")
    public String email;

    public String validate() {
        User user = User.findByEmail(email);
        if (user == null) {
            //no such user
            return "user not found";
        }
        //handle the toggle user isEnabled process
        play.Logger.warn(""+user.getIsEnabled());
       
       
        if (user.getIsEnabled() == 1){
             play.Logger.warn("disable");
            user.setIsEnabled(0);
        }
        else{
           user.setIsEnabled(1);
        }
        user.save();
     
        return null;
    }
}
TOP

Related Classes of model.forms.UserForm

TOP
Copyright © 2018 www.massapi.com. 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.