Skip to content

Commit

Permalink
Matricola is no longer saved as data for each student
Browse files Browse the repository at this point in the history
  • Loading branch information
alemela committed Jul 14, 2014
1 parent d8a19db commit 1d560d2
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions registry/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ exports.handleMatricola = function (request, response) {

try {
studentInfo.Token = crypto.randomBytes(20).toString("hex");
delete studentInfo.Matricola;
} catch (error) {
utils.internalError(error, request, response);
return;
Expand Down Expand Up @@ -114,7 +113,6 @@ exports.handleMatricola = function (request, response) {
backend.writeStudentInfo({
"Nome": nome,
"Cognome": cognome,
"Matricola": matricola,
"Token": "",
"Blog": "",
"Twitter": "",
Expand All @@ -135,11 +133,8 @@ exports.handleMatricola = function (request, response) {

utils.readBodyJSON(request, response, function (message) {
var matricola = message.Matricola;
var checkData = message;
delete checkData.Matricola;
if (!backend.hasValidKeys(checkData) ||
message.Token !== undefined || !backend.validMatricola(matricola)
) {
message = undefined;
if (!backend.validMatricola(matricola)) {
utils.internalError("signup: invalid argument", request, response);
return;
}
Expand Down Expand Up @@ -199,11 +194,8 @@ exports.handleMatricola = function (request, response) {
exports.handleConfirm = function (request, response) {
utils.readBodyJSON(request, response, function (message) {
var matricola = message.Matricola;
var checkData = message;
delete checkData.Matricola;
if (!backend.hasValidKeys(checkData) ||
message.Token !== undefined || !backend.validMatricola(matricola)
) {
message = undefined;
if (!backend.validMatricola(matricola)) {
utils.internalError("signup: invalid argument", request, response);
return;
}
Expand Down

1 comment on commit 1d560d2

@alemela
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we don't save matricola, but we always use login info or user-written onces.
I removed also some unnecessary checks because the only content we want (and we check) is matricola.

Please sign in to comment.