mirror of https://github.com/statping/statping
force unique users - tmp changes
parent
48999957e7
commit
f8aed9444a
|
@ -37,6 +37,7 @@ before_deploy:
|
||||||
deploy:
|
deploy:
|
||||||
- provider: releases
|
- provider: releases
|
||||||
api_key: $GH_TOKEN
|
api_key: $GH_TOKEN
|
||||||
|
if: branch = master
|
||||||
file:
|
file:
|
||||||
- "build/statup-osx-x64.tar.gz"
|
- "build/statup-osx-x64.tar.gz"
|
||||||
- "build/statup-osx-x32.tar.gz"
|
- "build/statup-osx-x32.tar.gz"
|
||||||
|
|
14
main_test.go
14
main_test.go
|
@ -64,6 +64,10 @@ func TestRunAll(t *testing.T) {
|
||||||
t.Run(dbt+" Create Users", func(t *testing.T) {
|
t.Run(dbt+" Create Users", func(t *testing.T) {
|
||||||
RunUser_Create(t)
|
RunUser_Create(t)
|
||||||
})
|
})
|
||||||
|
t.Run(dbt+" Create Non Unique Users", func(t *testing.T) {
|
||||||
|
t.SkipNow()
|
||||||
|
RunUser_NonUniqueCreate(t)
|
||||||
|
})
|
||||||
t.Run(dbt+" Select Users", func(t *testing.T) {
|
t.Run(dbt+" Select Users", func(t *testing.T) {
|
||||||
RunUser_SelectAll(t)
|
RunUser_SelectAll(t)
|
||||||
})
|
})
|
||||||
|
@ -275,6 +279,16 @@ func RunUser_Create(t *testing.T) {
|
||||||
assert.Equal(t, int64(2), id)
|
assert.Equal(t, int64(2), id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func RunUser_NonUniqueCreate(t *testing.T) {
|
||||||
|
user := &core.User{
|
||||||
|
Username: "admin",
|
||||||
|
Password: "admin",
|
||||||
|
Email: "info@testuser.com",
|
||||||
|
}
|
||||||
|
_, err := user.Create()
|
||||||
|
assert.NotNil(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
func RunUser_Delete(t *testing.T) {
|
func RunUser_Delete(t *testing.T) {
|
||||||
user, err := core.SelectUser(2)
|
user, err := core.SelectUser(2)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
|
@ -13,12 +13,13 @@ CREATE TABLE users (
|
||||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
username VARCHAR(50),
|
username VARCHAR(50),
|
||||||
password text,
|
password text,
|
||||||
email text,
|
email VARCHAR (50),
|
||||||
api_key VARCHAR(50),
|
api_key VARCHAR(50),
|
||||||
api_secret VARCHAR(50),
|
api_secret VARCHAR(50),
|
||||||
administrator BOOL NOT NULL DEFAULT '0',
|
administrator BOOL NOT NULL DEFAULT '0',
|
||||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
INDEX (id)
|
INDEX (id),
|
||||||
|
UNIQUE (username, email)
|
||||||
);
|
);
|
||||||
CREATE TABLE services (
|
CREATE TABLE services (
|
||||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
|
|
@ -12,9 +12,9 @@ CREATE TABLE core (
|
||||||
|
|
||||||
CREATE TABLE users (
|
CREATE TABLE users (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
username text,
|
username VARCHAR (50) UNIQUE,
|
||||||
password text,
|
password text,
|
||||||
email text,
|
email VARCHAR (50) UNIQUE,
|
||||||
api_key text,
|
api_key text,
|
||||||
api_secret text,
|
api_secret text,
|
||||||
administrator bool,
|
administrator bool,
|
||||||
|
|
|
@ -18,7 +18,8 @@ CREATE TABLE users (
|
||||||
api_key text,
|
api_key text,
|
||||||
api_secret text,
|
api_secret text,
|
||||||
administrator bool,
|
administrator bool,
|
||||||
created_at DATETIME
|
created_at DATETIME,
|
||||||
|
UNIQUE (username, email)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE services (
|
CREATE TABLE services (
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
<div class="container col-md-7 col-sm-12 mt-md-5 bg-light">
|
<div class="container col-md-7 col-sm-12 mt-md-5 bg-light">
|
||||||
|
|
||||||
<div class="col-12 mt-3">
|
<div class="col-8 offset-2 mt-3">
|
||||||
|
|
||||||
{{ if .Error }}
|
{{ if .Error }}
|
||||||
<div class="alert alert-danger" role="alert">
|
<div class="alert alert-danger" role="alert">
|
||||||
|
@ -35,9 +35,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-12">
|
||||||
<button type="submit" class="btn btn-primary btn-block d-block d-md-none">Sign in</button>
|
<button type="submit" class="btn btn-primary btn-block">Sign in</button>
|
||||||
<button type="submit" class="btn btn-primary d-none d-md-block">Sign in</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in New Issue