Skip to content

Commit

Permalink
Disable account lookup on solo pools. (#310)
Browse files Browse the repository at this point in the history
Disable account lookup form element and display a message to notify the feature is not available.
  • Loading branch information
jholdstock committed Mar 12, 2021
1 parent 122cff6 commit 6735117
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions gui/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func (ui *GUI) account(w http.ResponseWriter, r *http.Request) {
CSRF: csrf.TemplateField(r),
Designation: ui.cfg.Designation,
ShowMenu: true,
SoloPool: ui.cfg.SoloPool,
},
MinedWork: recentWork,
PendingPaymentsTotal: totalPending,
Expand Down
1 change: 1 addition & 0 deletions gui/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func (ui *GUI) adminPage(w http.ResponseWriter, r *http.Request) {
CSRF: csrf.TemplateField(r),
Designation: ui.cfg.Designation,
ShowMenu: false,
SoloPool: ui.cfg.SoloPool,
},
PoolStatsData: poolStatsData{
LastWorkHeight: ui.cfg.FetchLastWorkHeight(),
Expand Down
2 changes: 1 addition & 1 deletion gui/assets/public/css/dcrpool.css
Original file line number Diff line number Diff line change
Expand Up @@ -8656,7 +8656,7 @@ https://flickity.metafizzy.co
font-size: 14px;
height: 20px;
margin-top: 2px;
opacity: 0;
opacity: 1;
transition: all 0.25s;
}

Expand Down
6 changes: 3 additions & 3 deletions gui/assets/templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ <h1 class="modal-title">Account Information</h1>
<p>To know your mining account details, enter your mining address.</p>
<form class="modal-form" id="account-form" action="/account" method="head">
<div class="modal-input">
<input type="text" name="address" required placeholder="Mining Address" spellcheck="false">
<input type="text" name="address" required {{ if .SoloPool }}disabled{{end}} placeholder="Mining Address" spellcheck="false">
<div class="icon-warning"></div>
</div>
<div class="err-message"></div>
<div class="err-message">{{ if .SoloPool }} Account lookup disabled in solo pool mode {{end}}</div>
</form>
<div class="d-flex flex-row pt-4 align-items-center">
<a data-toggle="modal" href="#admin-modal">I'm an Admin</a>
<button form="account-form" type="submit" class="btn btn-primary ml-auto">Enter</button>
<button form="account-form" type="submit" {{ if .SoloPool }}disabled{{end}} class="btn btn-primary ml-auto">Enter</button>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ type headerData struct {
CSRF template.HTML
Designation string
ShowMenu bool
SoloPool bool
}

// route configures the http router of the user interface.
Expand Down
1 change: 1 addition & 0 deletions gui/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func (ui *GUI) renderIndex(w http.ResponseWriter, r *http.Request, modalError st
CSRF: csrf.TemplateField(r),
Designation: ui.cfg.Designation,
ShowMenu: true,
SoloPool: ui.cfg.SoloPool,
},
PoolStatsData: poolStatsData{
LastWorkHeight: ui.cfg.FetchLastWorkHeight(),
Expand Down

0 comments on commit 6735117

Please sign in to comment.