Skip PresharedKey generation
Helpful for those who already have users deployed. Enter `-` in the Preshared Key field at user creation time to skip its creation. The template conf takes care of the rest. Fixes issue #235
This commit is contained in:
		
							parent
							
								
									be2ffba417
								
							
						
					
					
						commit
						eb8b597573
					
				|  | @ -231,6 +231,9 @@ func NewClient(db store.IStore) echo.HandlerFunc { | |||
| 				}) | ||||
| 			} | ||||
| 			client.PresharedKey = presharedKey.String() | ||||
| 		} else if client.PresharedKey == "-" { | ||||
| 			client.PresharedKey = "" | ||||
| 			log.Infof("skipped PresharedKey generation for user: %v", client.Name) | ||||
| 		} else { | ||||
| 			_, err := wgtypes.ParseKey(client.PresharedKey) | ||||
| 			if err != nil { | ||||
|  |  | |||
|  | @ -206,7 +206,7 @@ | |||
|                                 <summary><strong>Public and Preshared Keys</strong> | ||||
|                                     <i class="fas fa-info-circle" data-toggle="tooltip" | ||||
|                                        data-original-title="If you don't want to let the server generate and store the | ||||
|                                        client's private, you can manually specify its public and preshared key here | ||||
|                                        client's private key, you can manually specify its public and preshared key here | ||||
|                                        . Note: QR code will not be generated"> | ||||
|                                     </i> | ||||
|                                 </summary> | ||||
|  | @ -220,7 +220,7 @@ | |||
|                                     <label for="client_preshared_key" class="control-label"> | ||||
|                                         Preshared Key | ||||
|                                     </label> | ||||
|                                     <input type="text" class="form-control" id="client_preshared_key" name="client_preshared_key" placeholder="Autogenerated"> | ||||
|                                     <input type="text" class="form-control" id="client_preshared_key" name="client_preshared_key" placeholder="Autogenerated - enter "-" to skip generation"> | ||||
|                                 </div> | ||||
|                             </details> | ||||
|                         </div> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue