Bugfixes and freedback addressing
This commit is contained in:
@@ -28,8 +28,9 @@ func (wikiAuth *WikiAthenticator) Name() string {
|
||||
// Find finds a user that has logged in at least once
|
||||
func (wikiAuth *WikiAthenticator) Find(username string) *auth.User {
|
||||
db := server.Main.DB
|
||||
fullID := wikiAuth.ID() + ":" + username
|
||||
|
||||
rows, err := db.Query("SELECT id,role FROM `user` WHERE id=?", username)
|
||||
rows, err := db.Query("SELECT id,role FROM `user` WHERE id=?", fullID)
|
||||
if err != nil {
|
||||
log.Println("WikiAthenticator.Find:", err)
|
||||
return nil
|
||||
@@ -45,6 +46,7 @@ func (wikiAuth *WikiAthenticator) Find(username string) *auth.User {
|
||||
role := "member"
|
||||
rows.Scan(&user.ID, &role)
|
||||
user.Data["role"] = role
|
||||
user.ID = strings.SplitN(user.ID, ":", 2)[1]
|
||||
|
||||
return user
|
||||
}
|
||||
@@ -79,7 +81,7 @@ func (wikiAuth *WikiAthenticator) Login(username, password string) (*auth.User,
|
||||
return nil, fmt.Errorf("Login failed %v", err)
|
||||
}
|
||||
|
||||
return auth.NewUser(wikiAuth, fullID, "member", nil), nil
|
||||
return auth.NewUser(wikiAuth, username, "member", nil), nil
|
||||
}
|
||||
|
||||
// If the user was found, read it in
|
||||
|
||||
@@ -3,7 +3,6 @@ package formparser
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -31,8 +30,6 @@ func Select(value string, target *string, allowedValues []string, optional bool)
|
||||
return nil
|
||||
}
|
||||
|
||||
log.Println(value, allowedValues)
|
||||
|
||||
for _, allowedValue := range allowedValues {
|
||||
if value == allowedValue {
|
||||
*target = value
|
||||
|
||||
+4
-4
@@ -21,11 +21,11 @@ func (category *PageCategory) URLRoot() string {
|
||||
// a limited selection of categories. I may move it to a configuration
|
||||
// or the database, but for now I think this list is pretty fixed
|
||||
var PageCategories = []PageCategory{
|
||||
{"OoC", "OoC", "O", "OoC content is for announcements, scheduling, general information, or anything that is not in-universe"},
|
||||
{"Info", "Info", "i", "Information gained during and between RP sessions"},
|
||||
//{"OoC", "OoC", "O", "OoC content is for announcements, scheduling, general information, or anything that is not in-universe"},
|
||||
{"Info", "Info", "i", "Information relevant to RP that might be something looked for in IRC logs"},
|
||||
{"News", "News", "N", "News stories that might be pertinent to ongoing plots"},
|
||||
{"Item", "Items", "I", "Items relevant to plots, that is more than just a document saved on a character's own omni-tool"},
|
||||
{"Document", "Document", "D", "Data files, shadow broker dossiers, and other data that is not inside an item"},
|
||||
//{"Item", "Items", "I", "Items relevant to plots, that is more than just a document saved on a character's own omni-tool"},
|
||||
{"Document", "Documents", "D", "Data files, shadow broker dossiers, and other data that is not inside an item"},
|
||||
{"Background", "Background", "B", "Rumors, suspicious persons, or inter-RP occurences that may be noticed"},
|
||||
{"Story", "Stories", "S", "Background stories and inter-RP character intearactions"},
|
||||
}
|
||||
|
||||
@@ -206,6 +206,8 @@ func parseHeader(header *Header, rows *sql.Rows) error {
|
||||
rows.Scan(&header.ID, &header.Name, &header.Author, &header.Category, &fictionalDate, &publishDate, &editDate, &header.Dated, &tagID, &tagType, &tagName)
|
||||
if tagID != "" {
|
||||
header.PrimaryTag = &Tag{tagID, tagType, tagName}
|
||||
} else {
|
||||
header.PrimaryTag = nil
|
||||
}
|
||||
|
||||
header.FictionalDate, err = time.Parse("2006-01-02 15:04:05", fictionalDate)
|
||||
|
||||
@@ -16,6 +16,7 @@ var TagTypes = []string{
|
||||
"Event",
|
||||
"Organization",
|
||||
"Source",
|
||||
"Series",
|
||||
}
|
||||
|
||||
// Tag describes a tag
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ CREATE TABLE user (
|
||||
INDEX(role)
|
||||
);
|
||||
|
||||
INSERT INTO user (id, role) VALUES("test:Test", "restricted")
|
||||
INSERT INTO user (id, role) VALUES("test:Test", "restricted");
|
||||
|
||||
CREATE TABLE page (
|
||||
`id` CHAR(16) NOT NULL PRIMARY KEY,
|
||||
|
||||
@@ -2,7 +2,6 @@ package viewmodel
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"git.aiterp.net/AiteRP/aitestory/server"
|
||||
"git.aiterp.net/gisle/wrouter/auth"
|
||||
@@ -23,8 +22,6 @@ type Base struct {
|
||||
// InitBase initializes the base of the viewmodel
|
||||
func (base *Base) setupBase(user *auth.User, viewTitle string) {
|
||||
if user != nil {
|
||||
log.Printf("%+v", user)
|
||||
|
||||
base.User.ID = user.FullID()
|
||||
base.User.Name = user.ID
|
||||
base.User.Role = user.Data["role"]
|
||||
|
||||
Reference in New Issue
Block a user