// 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, formateur, util) {
this.nom = "register";
this.client = client;
this.formateur = formateur;
this.util = util;
};
euphorik.PageRegister.prototype.contenu = function() {
return '
';
};
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.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("Enregistrement réussi");
thisPage.pages.afficherPage("minichat");
}
}
);
};