mirror of
https://github.com/kataras/iris.git
synced 2025-12-21 03:47:04 +00:00
add context partial user helper and accept a generic interface on SetUser - the same method now returns an error if the given value does not complete at least one method of the User interface
This commit is contained in:
@@ -56,7 +56,9 @@ func h(ctx iris.Context) {
|
||||
// makes sure for that, otherwise this handler will not be executed.
|
||||
// OR:
|
||||
user := ctx.User()
|
||||
ctx.Writef("%s %s:%s", ctx.Path(), user.GetUsername(), user.GetPassword())
|
||||
username, _ := user.GetUsername()
|
||||
password, _ := user.GetPassword
|
||||
ctx.Writef("%s %s:%s", ctx.Path(), username, password)
|
||||
}
|
||||
|
||||
func logout(ctx iris.Context) {
|
||||
|
||||
Reference in New Issue
Block a user