nov showing a message that the rendez-vous id is generated.
This commit is contained in:
		
							parent
							
								
									04c8b441ac
								
							
						
					
					
						commit
						9f302fb457
					
				| @ -17,13 +17,11 @@ func generateCLIExammple(w http.ResponseWriter, r *http.Request) { | ||||
| 		http.Error(w, "Error parsing form", http.StatusBadRequest) | ||||
| 		return | ||||
| 	} | ||||
| 	ids := r.Form["rendez-vous-id"] | ||||
| 	id := "" | ||||
| 	if len(ids) > 0 { | ||||
| 		id = strings.TrimSpace(ids[0]) | ||||
| 	} | ||||
| 	id := r.FormValue("rendez-vous-id") | ||||
| 	generatedId := false | ||||
| 	if id == "" { | ||||
| 		id = strconv.Itoa(rand.Int() % 1000000) | ||||
| 		generatedId = true | ||||
| 	} | ||||
| 
 | ||||
| 	remoteShells := r.Form["remote-shell"] | ||||
| @ -36,6 +34,9 @@ func generateCLIExammple(w http.ResponseWriter, r *http.Request) { | ||||
| 	sshPublicKeys := strings.Split(keysString, "\n") | ||||
| 	usageInputs := templates.NewUsageInputs(id, sshPublicKeys, remoteShells, localShells, downloadCommand, | ||||
| 		certificateValidation) | ||||
| 	if generatedId { | ||||
| 		usageInputs.ErrorMessages = append(usageInputs.ErrorMessages, "rendez-vous id is randomly generated, changes on every page refresh") | ||||
| 	} | ||||
| 	matched, _ := regexp.MatchString("^[a-zA-Z0-9-_]+$", id) | ||||
| 	if !matched { | ||||
| 		usageInputs.ErrorMessages = append(usageInputs.ErrorMessages, "ID may consist only of alphanumeric characters, '-', and '_'") | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user