Skip to content

Commit

Permalink
(BIDS-2417) Changed validator name change handler function
Browse files Browse the repository at this point in the history
  • Loading branch information
Eisei24 committed Sep 12, 2023
1 parent e4dc883 commit 9a5634c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/explorer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ func main() {
router.HandleFunc("/validator/{pubkey}/deposits", handlers.ValidatorDeposits).Methods("GET")
router.HandleFunc("/validator/{index}/slashings", handlers.ValidatorSlashings).Methods("GET")
router.HandleFunc("/validator/{index}/effectiveness", handlers.ValidatorAttestationInclusionEffectiveness).Methods("GET")
router.HandleFunc("/validator/save", handlers.ValidatorSave).Methods("POST")
router.HandleFunc("/validator/{pubkey}/name", handlers.ValidatorName).Methods("POST")
router.HandleFunc("/watchlist/add", handlers.UsersModalAddValidator).Methods("POST")
router.HandleFunc("/validator/{pubkey}/remove", handlers.UserValidatorWatchlistRemove).Methods("POST")
router.HandleFunc("/validator/{index}/stats", handlers.ValidatorStatsTable).Methods("GET")
Expand Down
7 changes: 4 additions & 3 deletions handlers/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1377,8 +1377,10 @@ func sanitizeMessage(msg string) ([]byte, error) {
}
}

func ValidatorSave(w http.ResponseWriter, r *http.Request) {
pubkey := r.FormValue("pubkey")
func ValidatorName(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)

pubkey := vars["pubkey"]
pubkey = strings.ToLower(pubkey)
pubkey = strings.Replace(pubkey, "0x", "", -1)

Expand Down Expand Up @@ -1485,7 +1487,6 @@ func ValidatorSave(w http.ResponseWriter, r *http.Request) {
utils.SetFlash(w, r, validatorEditFlash, "Error: the provided signature is invalid")
http.Redirect(w, r, "/validator/"+pubkey, http.StatusMovedPermanently)
}

}

// ValidatorHistory returns a validators history in json
Expand Down
3 changes: 1 addition & 2 deletions templates/validator/modals.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h5 class="modal-title" id="bookmarkModalLabel">Add to Watchlist</h5>

{{ define "validatorEditModal" }}
<div class="modal fade" id="edit-validator-modal" tabindex="-1" role="dialog" aria-labelledby="edit-validator-modal-label" aria-hidden="true">
<form action="save" method="post">
<form action="0x{{ printf "%x" .PublicKey }}/name" method="POST">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
Expand All @@ -62,7 +62,6 @@ <h5 class="modal-title" id="exampleModalLabel">Edit validator details</h5>
<div class="modal-body">
<p>In order to save any validator details you will need to provide a signed message of the eth account that sent the first valid deposit ({{ formatEth1Address .Eth1DepositAddress }}) for verification. You can for example use <a target="_blank" href="https://www.mycrypto.com/sign-and-verify-message/sign">MyCrypto</a> or <a target="_blank" href="https://www.myetherwallet.com/wallet/sign">MyEtherWallet</a> to generate the signature.</p>
<p>The signature text MUST CONTAIN the string <b>beaconcha.in</b>.</p>
<input type="hidden" value="0x{{ printf "%x" .PublicKey }}" name="pubkey" />
<div class="form-group">
<label for="input-name">Custom name or twitter handle</label>
<input class="form-control" id="input-name" type="text" maxlength="40" name="name" />
Expand Down

0 comments on commit 9a5634c

Please sign in to comment.