-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
396 additions
and
1,032 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,23 +61,25 @@ const ( | |
<body style="background-color: #f0f0f0"> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> | ||
<div style="position: relative;top: 20%%;margin:0 auto;width:360px;height:400px;"> | ||
<form style="height:100%%" action="%s" method="POST"> | ||
<form style="height:100%%" action="%s" method="POST" role="form" onsubmit="return true;"> | ||
<div id="divBorder" class="form-group divBorder"> | ||
<div> | ||
<h1 style="text-align: center;">Name</h1> | ||
</div><br> | ||
<div class="form-group"> | ||
<input type="email" class="form-control" id="email" placeholder="Name"> | ||
<input type="email" class="form-control" id="email" name="name" placeholder="邮箱"> | ||
<input type="hidden" class="form-control" id="flag" name="flag" value="2"> | ||
</div> | ||
<div class="form-group"> | ||
<input type="password" class="form-control" id="inputPassword3" placeholder="Password"> | ||
<input type="password" class="form-control" id="password" name="password" placeholder="密码"> | ||
</div> | ||
<div class="form-group"> | ||
<label><input type="checkbox"> Remember me</label> | ||
</div> | ||
<div class="form-group"> | ||
<button width="100%" type="submit" class="btn btn-primary btn-block">Sign in</button> | ||
<button width="100%" type="submit" class="btn btn-primary btn-block">登录</button> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package mysql | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/zzerroo/zauth" | ||
) | ||
|
||
func getMysqlConn() (*mysql, error) { | ||
mysql := &mysql{} | ||
erro := mysql.Open("root:xxx@tcp(127.0.0.1:3306)/auth?charset=utf8") | ||
if erro != nil { | ||
return nil, erro | ||
} | ||
|
||
return mysql, nil | ||
} | ||
|
||
func TestAll(t *testing.T) { | ||
mysql, erro := getMysqlConn() | ||
if erro != nil { | ||
t.Errorf("error open mysql conn") | ||
} | ||
|
||
var u1 zauth.UsrInfo | ||
u1.Name.String = "test1" | ||
u1.Pswd.String = "123456" | ||
u1.Email.String = "[email protected]" | ||
u1.Phone.String = "11111111111" | ||
u1.Other.String = "" | ||
erro = mysql.Register(&u1) | ||
if erro != nil { | ||
t.Errorf("error register user") | ||
} | ||
|
||
_, erro = mysql.LogIn(u1.Name.String, u1.Pswd.String, "0") | ||
if erro != nil { | ||
t.Errorf("error login 0") | ||
} | ||
|
||
_, erro = mysql.LogIn(u1.Phone.String, u1.Pswd.String, "1") | ||
if erro != nil { | ||
t.Errorf("error login 1") | ||
} | ||
|
||
_, erro = mysql.LogIn(u1.Email.String, u1.Pswd.String, "2") | ||
if erro != nil { | ||
t.Errorf("error login 2") | ||
} | ||
|
||
t.Log("ok") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.