From ef7b09454c7c4c309795156a897d7b6cffaaf01d Mon Sep 17 00:00:00 2001 From: pvincent Date: Sat, 28 Aug 2021 11:05:37 +0400 Subject: [PATCH] =?UTF-8?q?cagettep=C3=A9i?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 4 +- js/react/user/LoginBox.hx | 100 +++-- lang/master/tpl/base.mtt | 2 +- lang/master/tpl/design.mtt | 4 +- src/App.hx | 2 +- src/controller/Cron.hx | 4 +- src/controller/Member.hx | 786 ++++++++++++++++++------------------ src/service/OrderService.hx | 470 ++++++++++----------- 8 files changed, 686 insertions(+), 686 deletions(-) diff --git a/Makefile b/Makefile index 3b11090..63bb03a 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ install_dev: #compile backend to Neko compile: @if [ $(PLUGINS) = 1 ]; then \ - echo "compile Cagette.net with plugins"; \ + echo "compile CagettePéi plugins"; \ haxe cagetteAllPlugins.hxml; \ else \ echo "compile CagettePéi core"; \ @@ -74,7 +74,7 @@ templates: @make LANG=fr ctemplates msgfmt www/lang/texts_fr.po -o www/lang/texts_fr.mo chown www-data:www-data -R www - chown www-data:www-data -R lang + chown www-data:www-data -R lang/fr ctemplates: (cd lang/$(LANG)/tpl; temploc2 -macros macros.mtt -output ../tmp/ *.mtt */*.mtt */*/*.mtt) diff --git a/js/react/user/LoginBox.hx b/js/react/user/LoginBox.hx index 0db3a9f..24eb661 100644 --- a/js/react/user/LoginBox.hx +++ b/js/react/user/LoginBox.hx @@ -1,4 +1,5 @@ package react.user; + import react.ReactComponent; import react.ReactMacro.jsx; import Common; @@ -19,23 +20,21 @@ typedef LoginBoxState = { * Login Box * @author fbarbut */ -class LoginBox extends react.ReactComponentOfPropsAndState -{ - - public function new(props:LoginBoxProps) - { - if (props.redirectUrl == null) props.redirectUrl = "/"; - if (props.message == "") props.message = null; - super(props); - this.state = {email:"", password:"", error:null}; +class LoginBox extends react.ReactComponentOfPropsAndState { + public function new(props:LoginBoxProps) { + if (props.redirectUrl == null) + props.redirectUrl = "/"; + if (props.message == "") + props.message = null; + super(props); + this.state = {email: "", password: "", error: null}; } - - function setError(err:String){ - this.setState(cast {error:err}); + + function setError(err:String) { + this.setState(cast {error: err}); } - - override public function render(){ - + + override public function render() { return jsx('
<$Error error="${state.error}" /> <$Message message="${props.message}" /> @@ -62,78 +61,75 @@ class LoginBox extends react.ReactComponentOfPropsAndState

- C\'est votre première visite sur Cagette.net ?   + C\'est votre première visite sur CagettePéi ?   S\'inscrire

-->
'); } - + /** * @doc https://facebook.github.io/react/docs/forms.html */ - function onChange(e:js.html.Event){ + function onChange(e:js.html.Event) { e.preventDefault(); - - var name :String = untyped e.target.name; - var value :String = untyped /*(e.target.value == "") ? null :*/ e.target.value; + + var name:String = untyped e.target.name; + var value:String = untyped /*(e.target.value == "") ? null :*/ e.target.value; Reflect.setField(state, name, value); this.setState(this.state); } - + /** * displays a registerBox */ - public function registerBox(){ - + public function registerBox() { var body = js.Browser.document.querySelector('#myModal .modal-body'); - ReactDOM.unmountComponentAtNode( body ); - + ReactDOM.unmountComponentAtNode(body); + js.Browser.document.querySelector("#myModal .modal-title").innerHTML = "Inscription"; - ReactDOM.render(jsx('<$RegisterBox redirectUrl="${props.redirectUrl}" phoneRequired="${props.phoneRequired}"/>'), body ); + ReactDOM.render(jsx('<$RegisterBox redirectUrl="${props.redirectUrl}" phoneRequired="${props.phoneRequired}"/>'), body); } - - public function submit(?e:js.html.Event){ - - if (state.email == ""){ + + public function submit(?e:js.html.Event) { + if (state.email == "") { setError("Veuillez saisir votre email"); return; } - if (state.password == ""){ + if (state.password == "") { setError("Veuillez saisir votre mot de passe"); return; } - - //lock button - var el: js.html.Element = null; - if(e!=null){ + + // lock button + var el:js.html.Element = null; + if (e != null) { el = cast e.target; el.classList.add("disabled"); } - - + var req = new haxe.Http("/api/user/login"); req.addParameter("email", state.email); req.addParameter("password", state.password); req.addParameter("redirecturl", props.redirectUrl); - - req.onData = req.onError = function(d){ - + + req.onData = req.onError = function(d) { var d = req.responseData; - - if(e!=null) el.classList.remove("disabled"); - + + if (e != null) + el.classList.remove("disabled"); + var d = haxe.Json.parse(d); - if (Reflect.hasField(d, "error")) setError(d.error.message); - if (Reflect.hasField(d, "success")) js.Browser.window.location.href = props.redirectUrl; + if (Reflect.hasField(d, "error")) + setError(d.error.message); + if (Reflect.hasField(d, "success")) + js.Browser.window.location.href = props.redirectUrl; } req.request(true); } - function onKeyPress(e:js.html.KeyboardEvent){ - if(e.key=="Enter") submit(); + function onKeyPress(e:js.html.KeyboardEvent) { + if (e.key == "Enter") + submit(); } - - - -} \ No newline at end of file +} diff --git a/lang/master/tpl/base.mtt b/lang/master/tpl/base.mtt index c3115a0..32018ff 100644 --- a/lang/master/tpl/base.mtt +++ b/lang/master/tpl/base.mtt @@ -11,7 +11,7 @@ ::end:: - +