b6931fe16a
Run group promotions on group change. Run group promotions on registration. Load the CreatedAt field when users are loaded. Set the default for last_ip properly. Fix the default values in the group promotion form. Add initial group promotion tests. Add panel_group_promotion_registered_for phrase. Add the registeredFor column to the users_groups_promotions table. You will need to run the updater / patcher for this commit.
31 lines
1009 B
Go
31 lines
1009 B
Go
package routes
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
c "github.com/Azareal/Gosora/common"
|
|
"github.com/Azareal/Gosora/common/phrases"
|
|
)
|
|
|
|
func IPSearch(w http.ResponseWriter, r *http.Request, user c.User, h *c.Header) c.RouteError {
|
|
h.Title = phrases.GetTitlePhrase("ip_search")
|
|
// TODO: How should we handle the permissions if we extend this into an alt detector of sorts?
|
|
if !user.Perms.ViewIPs {
|
|
return c.NoPermissions(w, r, user)
|
|
}
|
|
|
|
// TODO: Reject IP Addresses with illegal characters
|
|
ip := c.SanitiseSingleLine(r.FormValue("ip"))
|
|
uids, err := c.IPSearch.Lookup(ip)
|
|
if err != nil {
|
|
return c.InternalError(err, w, r)
|
|
}
|
|
|
|
// TODO: What if a user is deleted via the Control Panel? We'll cross that bridge when we come to it, although we might lean towards blanking the account and removing the related data rather than purging it
|
|
userList, err := c.Users.BulkGetMap(uids)
|
|
if err != nil {
|
|
return c.InternalError(err, w, r)
|
|
}
|
|
return renderTemplate("ip_search", w, r, h, c.IPSearchPage{h, userList, ip})
|
|
}
|