chore(i18n,curriculum): processed translations (#42868)

This commit is contained in:
camperbot
2021-07-16 11:03:16 +05:30
committed by GitHub
parent 1f5f07cad3
commit 3b32da0191
429 changed files with 7502 additions and 4006 deletions

View File

@@ -1,6 +1,6 @@
---
id: 5895f70cf9fc0f352b528e67
title: Implement the Serialization of a Passport User
title: Implementare la serializzazione di un utente Passport
challengeType: 2
forumTopicId: 301556
dashedName: implement-the-serialization-of-a-passport-user
@@ -8,11 +8,11 @@ dashedName: implement-the-serialization-of-a-passport-user
# --description--
Right now, we're not loading an actual user object since we haven't set up our database. This can be done many different ways, but for our project we will connect to the database once when we start the server and keep a persistent connection for the full life-cycle of the app. To do this, add your database's connection string (for example: `mongodb+srv://:@cluster0-jvwxi.mongodb.net/?retryWrites=true&w=majority`) to the environment variable `MONGO_URI`. This is used in the `connection.js` file.
Per ora non stiamo caricando un oggetto utente reale visto che non abbiamo creato il database. Questo può essere fatto in molti modi diversi, ma per il nostro progetto ci connetteremo al database una volta che avremo avviato il server e ottenuto una connessione persistente per tutto il ciclo di vita dell'app. Per fare questo, aggiungi la stringa di connessione del database (per esempio: `mongodb+srv://:@cluster0-jvwxi.mongodb.net/?retryWrites=true&w=majority`) alla variabile ambientale `MONGO_URI`. Questo è usato nel file `connection.js`.
*You can set up a free database on [MongoDB Atlas](https://www.mongodb.com/cloud/atlas).*
*Puoi creare un database gratuito su [MongoDB Atlas](https://www.mongodb.com/cloud/atlas).*
Now we want to connect to our database then start listening for requests. The purpose of this is to not allow requests before our database is connected or if there is a database error. To accomplish this, you will want to encompass your serialization and your app routes in the following code:
Ora vogliamo connetterci al nostro database e metterci in ascolto delle richieste. Lo scopo è di non permettere richieste prima che il database sia connesso o nel caso ci sia un errore del database. Per farlo, dovrai includere la tua serializzazione e le rotte della tua app nel seguente codice:
```js
myDB(async client => {
@@ -38,13 +38,13 @@ myDB(async client => {
// app.listen out here...
```
Be sure to uncomment the `myDataBase` code in `deserializeUser`, and edit your `done(null, null)` to include the `doc`.
Assicurati di decommentare il codice di `myDataBase` in `deserializeUser`, e modifica il tuo `done(null, null)` per includere il `doc`.
Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point [here](https://gist.github.com/camperbot/175f2f585a2d8034044c7e8857d5add7).
Invia la tua pagina quando pensi di averlo fatto correttamente. Se dovessi incontrare degli errori, puoi controllare il progetto completato fino a questo punto [qui](https://gist.github.com/camperbot/175f2f585a2d8034044c7e8857d5add7).
# --hints--
Database connection should be present.
La connessione al database dovrebbe essere presente.
```js
(getUserInput) =>
@@ -62,7 +62,7 @@ Database connection should be present.
);
```
Deserialization should now be correctly using the DB and `done(null, null)` should be called with the `doc`.
La deserializzazione dovrebbe ora usare correttamente il DB e `done(null, null)` dovrebbe essere invocato con il `doc`.
```js
(getUserInput) =>

View File

@@ -1,6 +1,6 @@
---
id: 589a8eb3f9fc0f352b528e72
title: Implementation of Social Authentication III
title: Implementazione dell'autenticazione con i social III
challengeType: 2
forumTopicId: 301558
dashedName: implementation-of-social-authentication-iii
@@ -8,7 +8,7 @@ dashedName: implementation-of-social-authentication-iii
# --description--
The final part of the strategy is handling the profile returned from GitHub. We need to load the user's database object if it exists, or create one if it doesn't, and populate the fields from the profile, then return the user's object. GitHub supplies us a unique *id* within each profile which we can use to search with to serialize the user with (already implemented). Below is an example implementation you can use in your project--it goes within the function that is the second argument for the new strategy, right below where `console.log(profile);` currently is:
La parte finale della strategia è gestire il profilo restituito da GitHub. Dobbiamo caricare l'oggetto del database relativo all'uutente se esiste, o crearne uno se non esiste, e popolare i campi dal profilo, quindi restituire l'oggetto dell'utente. GitHub ci fornisce un *id* unico per ogni profilo che possiamo usare per cercare e serializzare l'utente (già implementato). Di seguito è riportato un esempio di implementazione che puoi usare nel tuo progetto: va all'interno della funzione che è il secondo argomento per la nuova strategia, proprio sotto all'attuale posizione di `console.log(profile);`:
```js
myDataBase.findOneAndUpdate(
@@ -38,15 +38,15 @@ myDataBase.findOneAndUpdate(
);
```
`findOneAndUpdate` allows you to search for an object and update it. If the object doesn't exist, it will be inserted and made available to the callback function. In this example, we always set `last_login`, increment the `login_count` by `1`, and only populate the majority of the fields when a new object (new user) is inserted. Notice the use of default values. Sometimes a profile returned won't have all the information filled out or the user will keep it private. In this case, you handle it to prevent an error.
`findOneAndUpdate` ti permette di cercare un oggetto e aggiornarlo. Se l'oggetto non esiste, verrà inserito e reso disponibile alla funzione di callback. In questo esempio, abbiamo sempre impostato `last_login`, incrementato il `login_count` di `1`, e popolato la maggior parte dei campi solo quando viene inserito un nuovo oggetto (nuovo utente). Nota l'uso dei valori predefiniti. A volte un profilo restituito non avrà tutte le informazioni compilate o l'utente lo manterrà privato. Dovrai gestire questo caso per evitare un errore.
You should be able to login to your app now--try it!
Ora dovresti essere in grado di accedere alla tua app, provala!
Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point [here](https://gist.github.com/camperbot/183e968f0e01d81dde015d45ba9d2745).
Invia la tua pagina quando pensi di averlo fatto correttamente. Se incontri degli errori, puoi controllare il progetto completato fino a questo punto [qui](https://gist.github.com/camperbot/183e968f0e01d81dde015d45ba9d2745).
# --hints--
GitHub strategy setup should be complete.
La configurazione della strategia GitHub dovrebbe essere completa.
```js
(getUserInput) =>

View File

@@ -1,6 +1,6 @@
---
id: 5895f70cf9fc0f352b528e66
title: Serialization of a User Object
title: Serializzazione di un oggetto utente
challengeType: 2
forumTopicId: 301563
dashedName: serialization-of-a-user-object
@@ -8,11 +8,11 @@ dashedName: serialization-of-a-user-object
# --description--
Serialization and deserialization are important concepts in regards to authentication. To serialize an object means to convert its contents into a small *key* that can then be deserialized into the original object. This is what allows us to know who has communicated with the server without having to send the authentication data, like the username and password, at each request for a new page.
La serializzazione e la deserializzazione sono concetti importanti per quanto riguarda l'autenticazione. Serializzare un oggetto significa convertire il suo contenuto in una piccola *chiave* (key) che può essere deserializzata nell'oggetto originale. Questo ci permette di sapere chi ha comunicato con il server senza dover inviare i dati di autenticazione, come il nome utente e la password, ad ogni richiesta di una nuova pagina.
To set this up properly, we need to have a serialize function and a deserialize function. In Passport, we create these with `passport.serializeUser( OURFUNCTION )` and `passport.deserializeUser( OURFUNCTION )`
Per configurarlo correttamente, dobbiamo avere una funzione di serializzazione e una funzione di deserializzazione. In Passport, li creiamo con `passport.serializeUser( OURFUNCTION )` e `passport.deserializeUser( OURFUNCTION )`
The `serializeUser` is called with 2 arguments, the full user object and a callback used by passport. A unique key to identify that user should be returned in the callback, the easiest one to use being the user's `_id` in the object. It should be unique as it is generated by MongoDB. Similarly, `deserializeUser` is called with that key and a callback function for passport as well, but, this time, we have to take that key and return the full user object to the callback. To make a query search for a Mongo `_id`, you will have to create `const ObjectID = require('mongodb').ObjectID;`, and then to use it you call `new ObjectID(THE_ID)`. Be sure to add `mongodb@~3.6.0` as a dependency. You can see this in the examples below:
`serializeUser` è chiamato con 2 argomenti, l'oggetto utente completo e una callback utilizzata da passport. Una chiave univoca per identificare quell'utente deve essere restituita nella callback, quello più semplice da usare è l'`_id` dell'utente nell'oggetto. Esso dovrebbe essere unico dato che è stato generato da MongoDB. Allo stesso modo, anche `deserializeUser` viene chiamato con quella chiave e una funzione callback per passport, ma questa volta dobbiamo prendere quella chiave e restituire l'intero oggetto utente alla callback. Per creare una query di ricerca per un `_id` Mongo, dovrai creare `const ObjectID = require('mongodb').ObjectID;`, e poi per usarlo invocare `new ObjectID(THE_ID)`. Assicurati di aggiungere `mongodb@~3.6.0` come dipendenza. Puoi vederlo negli esempi qui sotto:
```js
passport.serializeUser((user, done) => {
@@ -26,13 +26,13 @@ passport.deserializeUser((id, done) => {
});
```
NOTE: This `deserializeUser` will throw an error until we set up the DB in the next step, so for now comment out the whole block and just call `done(null, null)` in the function `deserializeUser`.
NOTA: Questo `deserializeUser` genererà un errore fino a quando non imposteremo il DB nel passo successivo, quindi per ora commenta l'intero blocco e chiama `done(null, null)` nella funzione `deserializeUser`.
Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point [here](https://gist.github.com/camperbot/7068a0d09e61ec7424572b366751f048).
Invia la tua pagina quando pensi di averlo fatto correttamente. Se incontri degli errori, puoi controllare il progetto completato fino a questo punto [qui](https://gist.github.com/camperbot/7068a0d09e61ec7424572b366751f048).
# --hints--
You should serialize user function correctly.
Dovresti serializzare correttamente la funzione user.
```js
(getUserInput) =>
@@ -55,7 +55,7 @@ You should serialize user function correctly.
);
```
You should deserialize user function correctly.
Dovresti deserializzare correttamente la funzione user.
```js
(getUserInput) =>
@@ -78,7 +78,7 @@ You should deserialize user function correctly.
);
```
MongoDB should be a dependency.
MongoDB dovrebbe essere una dipendenza.
```js
(getUserInput) =>
@@ -97,7 +97,7 @@ MongoDB should be a dependency.
);
```
Mongodb should be properly required including the ObjectId.
Mongodb dovrebbe essere richiesto correttamente, includendo l'ObjectId.
```js
(getUserInput) =>