2 // Copyright 2008 Grégory Burri
4 // This file is part of Euphorik.
6 // Euphorik is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
11 // Euphorik is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with Euphorik. If not, see <http://www.gnu.org/licenses/>.
19 euphorik
.PageRegister = function(client
, formateur
, util
) {
20 this.nom
= "register";
23 this.formateur
= formateur
;
27 euphorik
.PageRegister
.prototype.contenu = function() {
28 return '<form action="" id="register" >' +
32 ' <td><input class="login" type="text" size="20" maxlength="20"/><input class="captcha" name="captcha" type="text" size="12"></input></td>' +
33 ' <td>(sensible à la <a href="http://fr.wikipedia.org/wiki/Casse_(informatique)">casse</a>)</td>' +
36 ' <td>password</td>' +
37 ' <td><input class="password" type="password" size="20" maxlength="20"/></td>' +
40 ' <td>password re</td>' +
41 ' <td><input class="passwordRe" type="password" size="20" maxlength="20"/></td>' +
45 ' <td><button>valider</button>' +
51 euphorik
.PageRegister
.prototype.charger = function() {
52 $("#page form#register").submit(function(){ return false; });
56 $("#page form#register button").click(
58 if ($("#page form#register input.captcha").val() !== "") {
62 var login
= $("#page form#register input.login").val().trim();
63 var password
= $("#page form#register input.password").val();
64 var passwordRe
= $("#page form#register input.passwordRe").val();
67 thisPage
.util
.messageDialogue("Le login ne doit pas être vide");
68 } else if (password
=== "" && passwordRe
=== "") {
69 thisPage
.util
.messageDialogue("Un mot de passe est obligatoire");
70 } else if (password
!== passwordRe
) {
71 thisPage
.util
.messageDialogue("Les mots de passes ne correspondent pas");
72 } else if(thisPage
.client
.enregistrement(login
, thisPage
.util
.md5(password
))) {
73 thisPage
.util
.messageDialogue("Enregistrement réussi");
74 thisPage
.pages
.afficherPage("minichat");