prepared for encryption

This commit is contained in:
didier amyot committed 2016-02-19 16:20:08 -05:00
1 parent 83e957965f
commit 7f0bbbb55b
2 files changed
+58 -48

No files matched your search

+1 -3
View File
@@ -1,5 +1,4 @@
requirejs.config({ requirejs.config({
// baseUrl: 'lib',
paths: { paths: {
'_': '../lib/lodash/dist/lodash.min', '_': '../lib/lodash/dist/lodash.min',
'm': '../lib/mithril/mithril.min' 'm': '../lib/mithril/mithril.min'
@@ -15,7 +14,6 @@ requirejs(['m', 'views/mainPage', 'views/calendarPage', 'views/rulesPage', 'view
"/reglement": rulesPage, "/reglement": rulesPage,
"/photos": photosPage, "/photos": photosPage,
"/membre": confidentialPage, "/membre": confidentialPage,
"/contact": contactPage, "/contact": contactPage
"/login": loginPage
}); });
}); });
+57 -45
View File
@@ -1,7 +1,7 @@
define(['m', '_', 'teams', 'views/topNavBar', 'views/footer'], function (m, _ , teams, topNavBar, footer) { define(['m', '_', 'teams', 'views/topNavBar', 'views/footer'], function (m, _ , teams, topNavBar, footer) {
var confidentialSelection = {};
var confidentialSelection = {};
confidentialSelection.toggleTeam = function(teamId, activatedTeams){ confidentialSelection.toggleTeam = function(teamId, activatedTeams){
return function(isActive){ return function(isActive){
@@ -148,73 +148,85 @@ define(['m', '_', 'teams', 'views/topNavBar', 'views/footer'], function (m, _ ,
); );
}; };
var testComponent2 = {};
testComponent2.controller = function(){
var counter = m.prop(0);
return {counter: counter, plusplus: function(){
counter(counter() + 1);
}};
};
testComponent2.view = function(ctrl){
return m('button', {onclick: ctrl.plusplus}, "test component 2 " + ctrl.counter());
};
var testComponent = {};
testComponent.controller = function(){
var counter = m.prop(0);
return {counter: counter, plusplus: function(){
counter(counter() + 1);
}};
};
testComponent.view = function(ctrl){
return m('div', [
m('button', {onclick: ctrl.plusplus}, "test component " + ctrl.counter()),
m.component(testComponent2)]);
};
var confidentialPageBody = {}; var confidentialPageBody = {};
confidentialPageBody.controller = function(model){ confidentialPageBody.controller = function(){
var model = {};
model.activatedTeams = m.prop(['bleu', 'rouge', 'jaune', 'gris']); model.activatedTeams = m.prop(['bleu', 'rouge', 'jaune', 'gris']);
model.activatedScores = m.prop([1, 2, 3, 4, 5]); model.activatedScores = m.prop([1, 2, 3, 4, 5]);
return model; return model;
}; };
confidentialPageBody.view = function(model){ confidentialPageBody.view = function(model){
return m('div', [ return m('div.uk-grid.uk-margin-top.uk-margin-bottom',
m('div.uk-width-large-3-5.uk-width-small-1-1.uk-container-center', [
m.component(confidentialSelection, model), m.component(confidentialSelection, model),
m.component(confidentialTable, model), m.component(confidentialTable, model),
m.component(testComponent) ]));
};
var loginComponent = {};
loginComponent.controller = function(){
return {email: m.prop(), password: m.prop()};
};
loginComponent.logo = function(){
var style = 'height: 250px; width: 250px; background-size: 250px; background-image: url(images/logosansfond.JPG);';
return m('div.uk-cover-background.uk-container-center', {style: style});
};
loginComponent.logoLine = function(){
return m('div.uk-grid.uk-margin',
m('div.uk-width-1-1', loginComponent.logo()));
};
loginComponent.login = function(ctrl){
return function(){
var salt = "9'D)E@E{DSq[|l2bq!v";
window.secret = salt + ctrl.email() + ctrl.password();
};
};
loginComponent.loginForm = function(ctrl){
return m('div.uk-panel.uk-panel-box.uk-panel-box-secondary.uk-width-large-1-3.uk-container-center.uk-margin', [
m('form.uk-text-center', {onsubmit: m.withAttr("form", loginComponent.login(ctrl))},
m('div.uk-form-row',
m('label', "Nom d'utilisateur ",
m('input[type=text][required].uk-form-width-small', {oninput: m.withAttr("value", ctrl.email)}))),
m('div.uk-form-row',
m('label', "Mot de passe ",
m('input[type=password][required].uk-form-width-small', {oninput: m.withAttr("value", ctrl.password)}))),
m('div.uk-form-row', m('button.uk-button', m("i.fa.fa-mars-double"), " Pénétrez"))
)
]);
};
loginComponent.view = function(ctrl){
return m('div', [
loginComponent.logoLine(),
loginComponent.loginForm(ctrl)
]); ]);
}; };
var confidentialPage = {}; var confidentialPage = {};
confidentialPage.view = function(){ confidentialPage.view = function(){
var body;
if(!window.secret){
body = loginComponent;
}else{
body = confidentialPageBody;
}
return [ return [
m.component(topNavBar), m.component(topNavBar),
m('div.uk-grid.uk-margin-top.uk-margin-bottom', m.component(body),
m('div.uk-width-large-3-5.uk-width-small-1-1.uk-container-center',[
m.component(confidentialPageBody, {})
])),
m.component(footer) m.component(footer)
]; ];
}; };
return confidentialPage; return confidentialPage;
}); });