mirror of
https://github.com/unmojang/drasl.git
synced 2025-08-03 19:06:04 -04:00
Lint
This commit is contained in:
parent
0865865cd3
commit
e286356cd7
13
auth_test.go
13
auth_test.go
@ -223,11 +223,11 @@ func (ts *TestSuite) testAuthenticate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ts *TestSuite) testInvalidate(t *testing.T) {
|
func (ts *TestSuite) testInvalidate(t *testing.T) {
|
||||||
// First, authenticate to get a token pair
|
{
|
||||||
authenticateRes := ts.authenticate(t, TEST_PLAYER_NAME, TEST_PASSWORD)
|
authenticateRes := ts.authenticate(t, TEST_PLAYER_NAME, TEST_PASSWORD)
|
||||||
clientToken := authenticateRes.ClientToken
|
clientToken := authenticateRes.ClientToken
|
||||||
accessToken := authenticateRes.AccessToken
|
accessToken := authenticateRes.AccessToken
|
||||||
{
|
|
||||||
// Successful invalidate
|
// Successful invalidate
|
||||||
// We should start with valid clients in the database
|
// We should start with valid clients in the database
|
||||||
client := ts.App.GetClient(accessToken, StalePolicyDeny)
|
client := ts.App.GetClient(accessToken, StalePolicyDeny)
|
||||||
@ -259,12 +259,11 @@ func (ts *TestSuite) testInvalidate(t *testing.T) {
|
|||||||
assert.Equal(t, oldVersions[client.ClientToken]+1, client.Version)
|
assert.Equal(t, oldVersions[client.ClientToken]+1, client.Version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-authenticate
|
|
||||||
authenticateRes = ts.authenticate(t, TEST_PLAYER_NAME, TEST_PASSWORD)
|
|
||||||
clientToken = authenticateRes.ClientToken
|
|
||||||
accessToken = authenticateRes.AccessToken
|
|
||||||
{
|
{
|
||||||
|
// Re-authenticate
|
||||||
|
authenticateRes := ts.authenticate(t, TEST_PLAYER_NAME, TEST_PASSWORD)
|
||||||
|
clientToken := authenticateRes.ClientToken
|
||||||
|
|
||||||
// Invalidate should fail if we send an invalid access token
|
// Invalidate should fail if we send an invalid access token
|
||||||
payload := refreshRequest{
|
payload := refreshRequest{
|
||||||
ClientToken: clientToken,
|
ClientToken: clientToken,
|
||||||
|
2
front.go
2
front.go
@ -833,7 +833,7 @@ func frontChallenge(app *App, action string) func(c echo.Context) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
var userError *UserError
|
var userError *UserError
|
||||||
if errors.As(err, &userError) {
|
if errors.As(err, &userError) {
|
||||||
return NewWebError(returnURL, userError.Err.Error())
|
return NewWebError(returnURL, "Error: %s", userError.Err.Error())
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
5
user.go
5
user.go
@ -362,7 +362,10 @@ func (app *App) UpdateUser(
|
|||||||
if !callerIsAdmin {
|
if !callerIsAdmin {
|
||||||
return NewBadRequestUserError("Cannot change locked status of user without having admin privileges yourself.")
|
return NewBadRequestUserError("Cannot change locked status of user without having admin privileges yourself.")
|
||||||
}
|
}
|
||||||
app.SetIsLocked(tx, &user, *isLocked)
|
err := app.SetIsLocked(tx, &user, *isLocked)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := tx.Save(&user).Error; err != nil {
|
if err := tx.Save(&user).Error; err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user