|
|
@@ -28,6 +28,17 @@ func (Api) getUserAgent(ctx context.Context) string {
|
|
|
}
|
|
|
return ""
|
|
|
}
|
|
|
+
|
|
|
+func (Api) getToken(ctx context.Context) (token string) {
|
|
|
+ if md, ok := metadata.FromIncomingContext(ctx); ok {
|
|
|
+ sl := md.Get("token")
|
|
|
+ if len(sl) >= 1 {
|
|
|
+ token = sl[0]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
func (a Api) SignIn(ctx context.Context, q *pb.SignInRequest) (*pb.SignInReply, error) {
|
|
|
token := service.User{}.SignInUserCodePassword(
|
|
|
q.Name, q.Password, a.getRemoteIp(ctx), a.getUserAgent(ctx))
|