fcf.module({
  name: "fcfSimpleAuthorization:templates/login-by-email.wrapper.js",
  dependencies: ["fcf:NClient/Wrapper.js"],
  module: function(Wrapper){
    return class WrapperEx extends Wrapper{
      
      constructor(a_initializeOptions){
        super(a_initializeOptions);
        this._lock = false;
      }

      onArg (a_argName, a_value, a_editor) {
        if (a_editor.getParent() != this)
          this.update();
      }

      sendEmail() {
        let self = this;
        this._lock = true;
        return this.send({value: this.getArg("value")})
        .then(()=>{
          self._lock = false;
          self.setArg("confirmationMode", true);
        })
        .catch((a_error)=>{
          self.setArg("error", a_error.toString());
        })
      }

    };
  }
});
