X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=js%2FpageRegister.js;h=56be88526d9436cbfc518b6a525e0779c1a50a73;hp=30d179025afa1d27444b5ebd9dd47045773fb42d;hb=4a6c575807a90370c0069b688026b10102e1ce10;hpb=6feaef2a51f7226c41d69f9e86f605718b78aa02 diff --git a/js/pageRegister.js b/js/pageRegister.js index 30d1790..56be885 100755 --- a/js/pageRegister.js +++ b/js/pageRegister.js @@ -1,70 +1,78 @@ -// coding: utf-8 - -function PageRegister(client, formateur, util) -{ - this.nom = "register" - - this.client = client - this.formateur = formateur - this.util = util -} - -PageRegister.prototype.contenu = function() -{ - return '\ -
\ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ -
login\
password
password re
\ -
\ -' -} - -PageRegister.prototype.charger = function() -{ - jQuery("#page form#register").submit(function(){return false}) - - var thisPage = this - - jQuery("#page form#register button").click( - function() - { - if (jQuery("#page form#register input.captcha").val() != "") return - - var login = jQuery("#page form#register input.login").val().trim() - var password = jQuery("#page form#register input.password").val() - var passwordRe = jQuery("#page form#register input.passwordRe").val() - - if (login == "") - thisPage.util.messageDialogue("Le login ne doit pas être vide") - else if (password == "" && passwordRe == "") - thisPage.util.messageDialogue("Un mot de passe est obligatoire") - else if (password != passwordRe) - thisPage.util.messageDialogue("Les mots de passes ne correspondent pas") - else if(!thisPage.client.enregistrement(login, thisPage.util.md5(password))) - { - thisPage.util.messageDialogue(thisPage.client.dernierMessageErreur, messageType.erreur) - } - else - { - // TODO : avertir que l'enregistrement s'est bien déroulé - thisPage.client.majMenu() - thisPage.pages.afficherPage("minichat") - } - } - ) -} \ No newline at end of file +// coding: utf-8 +// Copyright 2008 Grégory Burri +// +// This file is part of Euphorik. +// +// Euphorik is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Euphorik is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Euphorik. If not, see . + +euphorik.PageRegister = function(client, formatter, util) { + this.name = "register"; + + this.client = client; + this.formatter = formatter; + this.util = util; +}; + +euphorik.PageRegister.prototype.contenu = function() { + return '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '
login(sensible à la casse)
password
password re
' + + ''; +}; + +euphorik.PageRegister.prototype.charger = function() { + $("#page form#register").submit(function(){ return false; }); + + var thisPage = this; + + $("#page form#register button").click( + function() { + if ($("#page form#register input.captcha").val() !== "") { + return; + } + + var login = $("#page form#register input.login").val().trim(); + var password = $("#page form#register input.password").val(); + var passwordRe = $("#page form#register input.passwordRe").val(); + + if (login === "") { + thisPage.util.messageDialog("Le login ne doit pas être vide"); + } else if (password === "" && passwordRe === "") { + thisPage.util.messageDialog("Un mot de passe est obligatoire"); + } else if (password !== passwordRe) { + thisPage.util.messageDialog("Les mots de passes ne correspondent pas"); + } else if (thisPage.client.enregistrement(login, thisPage.util.md5(password))) { + thisPage.util.messageDialog("Enregistrement réussi"); + thisPage.pages.displayPage("minichat"); + } + } + ); +};