@urga-panel/ur-panels-core 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,10 +22,11 @@ export declare abstract class AuthService extends Service {
22
22
  constructor(ots: AuthOts);
23
23
  protected abstract saveToken(token: string): Promise<void>;
24
24
  protected abstract clearToken(): Promise<void>;
25
- protected abstract getUserInfo({ userId, userName, userRole }: {
25
+ protected abstract getUserInfo({ userId, userName, userRole, userEmail }: {
26
26
  userId?: string;
27
27
  userName?: string;
28
28
  userRole?: string;
29
+ userEmail?: string;
29
30
  }): Promise<{
30
31
  success: boolean;
31
32
  message?: string;
@@ -46,8 +47,8 @@ export declare abstract class AuthService extends Service {
46
47
  request: any;
47
48
  url: any;
48
49
  }): Promise<any>;
49
- loginRequest({ username, password, params, request, url }: {
50
- username: any;
50
+ loginRequest({ email, password, params, request, url }: {
51
+ email: any;
51
52
  password: any;
52
53
  params: any;
53
54
  request: any;
@@ -70,7 +70,7 @@ export class AuthService extends Service {
70
70
  }
71
71
  }
72
72
  // Define methods specific to AuthService here
73
- async loginRequest({ username, password, params, request, url }) {
73
+ async loginRequest({ email, password, params, request, url }) {
74
74
  //const { username, password } = params;
75
75
  // Kullanıcı adı veya şifre eksikse
76
76
  //debugger;
@@ -79,10 +79,10 @@ export class AuthService extends Service {
79
79
  // const username = formData.get('username');
80
80
  // const password = formData.get('password');
81
81
  //debugger;
82
- if (!username || !password) {
83
- return this.resposeHandler({ status: "fail", message: "Kullanıcı adı ve şifre gereklidir" });
82
+ if (!email || !password) {
83
+ return this.resposeHandler({ status: "fail", message: "Email ve şifre gereklidir" });
84
84
  }
85
- const result = await this.getUserInfo({ userName: username });
85
+ const result = await this.getUserInfo({ userEmail: email });
86
86
  if (result.success) {
87
87
  let jwt;
88
88
  if (typeof window === "undefined") {
@@ -148,7 +148,8 @@ export class AuthService extends Service {
148
148
  const res = await this.getUserInfo({
149
149
  userId: decoded.id,
150
150
  userName: decoded.username,
151
- userRole: decoded.role || "user" // Varsayılan rol
151
+ userRole: decoded.role || "user",
152
+ userEmail: decoded.email
152
153
  });
153
154
  const newPanelToken = jwt.sign({
154
155
  id: decoded.id,
@@ -205,7 +206,8 @@ export class AuthService extends Service {
205
206
  const res = await this.getUserInfo({
206
207
  userId: (decodedRefresh as any).id,
207
208
  userName: (decodedRefresh as any).username,
208
- userRole: (decodedRefresh as any).role || "user" // Varsayılan rol
209
+ userRole: (decodedRefresh as any).role || "user",
210
+ userEmail: (decodedRefresh as any).email
209
211
  });
210
212
 
211
213
  if (!res.success) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urga-panel/ur-panels-core",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -66,10 +66,11 @@ export abstract class AuthService extends Service {
66
66
  // Abstract methods for platform-specific logic
67
67
  protected abstract saveToken(token: string): Promise<void>;
68
68
  protected abstract clearToken(): Promise<void>;
69
- protected abstract getUserInfo({ userId, userName, userRole }: {
69
+ protected abstract getUserInfo({ userId, userName, userRole, userEmail }: {
70
70
  userId?: string;
71
71
  userName?: string;
72
72
  userRole?: string;
73
+ userEmail?: string; // added for email-based lookup
73
74
  }): Promise<{
74
75
  success: boolean;
75
76
  message?: string;
@@ -119,7 +120,7 @@ export abstract class AuthService extends Service {
119
120
  }
120
121
 
121
122
  // Define methods specific to AuthService here
122
- async loginRequest({ username, password, params, request, url }): Promise<any> {
123
+ async loginRequest({ email, password, params, request, url }): Promise<any> {
123
124
  //const { username, password } = params;
124
125
  // Kullanıcı adı veya şifre eksikse
125
126
  //debugger;
@@ -128,11 +129,11 @@ export abstract class AuthService extends Service {
128
129
  // const username = formData.get('username');
129
130
  // const password = formData.get('password');
130
131
  //debugger;
131
- if (!username || !password) {
132
- return this.resposeHandler({ status: "fail", message: "Kullanıcı adı ve şifre gereklidir" });
132
+ if (!email || !password) {
133
+ return this.resposeHandler({ status: "fail", message: "Email ve şifre gereklidir" });
133
134
  }
134
135
 
135
- const result = await this.getUserInfo({ userName: username });
136
+ const result = await this.getUserInfo({ userEmail: email });
136
137
 
137
138
  if (result.success) {
138
139
  let jwt: typeof import("jsonwebtoken") | undefined;
@@ -229,7 +230,8 @@ export abstract class AuthService extends Service {
229
230
  const res = await this.getUserInfo({
230
231
  userId: (decoded as any).id,
231
232
  userName: (decoded as any).username,
232
- userRole: (decoded as any).role || "user" // Varsayılan rol
233
+ userRole: (decoded as any).role || "user",
234
+ userEmail: (decoded as any).email
233
235
  });
234
236
 
235
237
  const newPanelToken = jwt.sign(
@@ -293,7 +295,8 @@ export abstract class AuthService extends Service {
293
295
  const res = await this.getUserInfo({
294
296
  userId: (decodedRefresh as any).id,
295
297
  userName: (decodedRefresh as any).username,
296
- userRole: (decodedRefresh as any).role || "user" // Varsayılan rol
298
+ userRole: (decodedRefresh as any).role || "user",
299
+ userEmail: (decodedRefresh as any).email
297
300
  });
298
301
 
299
302
  if (!res.success) {