mirror of https://github.com/statping/statping
force unique users - tmp changes
parent
48999957e7
commit
f8aed9444a
|
@ -37,6 +37,7 @@ before_deploy:
|
|||
deploy:
|
||||
- provider: releases
|
||||
api_key: $GH_TOKEN
|
||||
if: branch = master
|
||||
file:
|
||||
- "build/statup-osx-x64.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) {
|
||||
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) {
|
||||
RunUser_SelectAll(t)
|
||||
})
|
||||
|
@ -275,6 +279,16 @@ func RunUser_Create(t *testing.T) {
|
|||
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) {
|
||||
user, err := core.SelectUser(2)
|
||||
assert.Nil(t, err)
|
||||
|
|
|
@ -13,12 +13,13 @@ CREATE TABLE users (
|
|||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
username VARCHAR(50),
|
||||
password text,
|
||||
email text,
|
||||
email VARCHAR (50),
|
||||
api_key VARCHAR(50),
|
||||
api_secret VARCHAR(50),
|
||||
administrator BOOL NOT NULL DEFAULT '0',
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
INDEX (id)
|
||||
INDEX (id),
|
||||
UNIQUE (username, email)
|
||||
);
|
||||
CREATE TABLE services (
|
||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
|
|
|
@ -12,9 +12,9 @@ CREATE TABLE core (
|
|||
|
||||
CREATE TABLE users (
|
||||
id SERIAL PRIMARY KEY,
|
||||
username text,
|
||||
username VARCHAR (50) UNIQUE,
|
||||
password text,
|
||||
email text,
|
||||
email VARCHAR (50) UNIQUE,
|
||||
api_key text,
|
||||
api_secret text,
|
||||
administrator bool,
|
||||
|
|
|
@ -18,7 +18,8 @@ CREATE TABLE users (
|
|||
api_key text,
|
||||
api_secret text,
|
||||
administrator bool,
|
||||
created_at DATETIME
|
||||
created_at DATETIME,
|
||||
UNIQUE (username, email)
|
||||
);
|
||||
|
||||
CREATE TABLE services (
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
<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 }}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
|
@ -35,9 +35,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-10">
|
||||
<button type="submit" class="btn btn-primary btn-block d-block d-md-none">Sign in</button>
|
||||
<button type="submit" class="btn btn-primary d-none d-md-block">Sign in</button>
|
||||
<div class="col-sm-12">
|
||||
<button type="submit" class="btn btn-primary btn-block">Sign in</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue