ntk-cms-api
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -33,6 +33,2 @@ import { BehaviorSubject, Observable } from 'rxjs'; | ||
getToken(): string; | ||
loggedIn(): boolean; | ||
isAuthenticated(): boolean; | ||
getDashboardUrl(): string; | ||
getLoginUrl(): string; | ||
} |
@@ -30,3 +30,2 @@ "use strict"; | ||
_this.CorrectTokenInfoBSObs = _this.CorrectTokenInfoBS.asObservable(); | ||
// jwtHelper = new JwtHelperService(); | ||
_this.userRoles = []; | ||
@@ -48,6 +47,2 @@ _this.userName = ''; | ||
this.CorrectTokenInfoBS.next(model); | ||
// this.store.dispatch(new fromStore.EditLoggedUser(model)); | ||
// const decodedToken = this.jwtHelper.decodeToken(model.token); | ||
// this.store.dispatch(new fromStore.EditDecodedToken(decodedToken)); | ||
// this.userRoles = decodedToken.role as Array<string>; | ||
}; | ||
@@ -61,3 +56,3 @@ CoreAuthService.prototype.CorrectTokenInfoBSRenew = function () { | ||
return this.http | ||
.get(this.baseUrl + this.getModuleCotrolerUrl() + 'CorrectToken', { | ||
.get(this.baseUrl + this.getModuleCotrolerUrl() + '/CorrectToken', { | ||
headers: this.getHeaders(), | ||
@@ -69,10 +64,3 @@ }) | ||
_this.SetCorrectTokenInfo(ret.Item); | ||
// const title = 'تایید توکن'; | ||
// const message = 'توکن شما مورد تایید سرور قرار گرفت'; | ||
// this.toastrService.success(message, title); | ||
} | ||
else { | ||
// this.toastrService.error(message, title); | ||
// this.router.navigate([environment.cmsUiConfig.Pathlogin]); | ||
} | ||
return ret; | ||
@@ -82,22 +70,5 @@ } | ||
.toPromise(); | ||
// this.ServiceRenewToken(null).subscribe( | ||
// (next) => { | ||
// if (next.IsSuccess) { | ||
// this.SetCorrectTokenInfo(next.Item); | ||
// } | ||
// }, | ||
// (error) => {} | ||
// ); | ||
}; | ||
CoreAuthService.prototype.ServiceCaptcha = function () { | ||
return this.http.get(this.baseUrl + this.getModuleCotrolerUrl() + 'captcha').pipe(operators_1.catchError(this.handleError), operators_1.map(function (ret) { | ||
// tslint:disable-next-line: no-empty | ||
if (ret.IsSuccess) { | ||
} | ||
else { | ||
// this.toastrService.error( | ||
// ret.ErrorMessage, | ||
// 'خطا در دریافت کلید عکس کپتچا' | ||
// ); | ||
} | ||
return this.http.get(this.baseUrl + this.getModuleCotrolerUrl() + '/captcha').pipe(operators_1.catchError(this.handleError), operators_1.map(function (ret) { | ||
return ret; | ||
@@ -107,3 +78,3 @@ })); | ||
CoreAuthService.prototype.ServiceGetTokenDevice = function (key) { | ||
return this.http.get(this.baseUrl + this.getModuleCotrolerUrl() + 'GetTokenDevice/' + key).pipe(operators_1.catchError(this.handleError), operators_1.map(function (ret) { | ||
return this.http.get(this.baseUrl + this.getModuleCotrolerUrl() + '/GetTokenDevice/' + key).pipe(operators_1.catchError(this.handleError), operators_1.map(function (ret) { | ||
return ret; | ||
@@ -113,3 +84,3 @@ })); | ||
CoreAuthService.prototype.ServiceSignupUser = function (model) { | ||
return this.http.post(this.baseUrl + this.getModuleCotrolerUrl() + 'signup', model).pipe(operators_1.catchError(this.handleError), operators_1.map(function (ret) { | ||
return this.http.post(this.baseUrl + this.getModuleCotrolerUrl() + '/signup', model).pipe(operators_1.catchError(this.handleError), operators_1.map(function (ret) { | ||
return ret; | ||
@@ -121,13 +92,7 @@ // } | ||
var _this = this; | ||
return this.http.post(this.baseUrl + this.getModuleCotrolerUrl() + 'signin', model).pipe(operators_1.catchError(this.handleError), operators_1.map(function (ret) { | ||
// if (ret) { | ||
return this.http.post(this.baseUrl + this.getModuleCotrolerUrl() + '/signin', model).pipe(operators_1.catchError(this.handleError), operators_1.map(function (ret) { | ||
if (ret.IsSuccess) { | ||
// this.toastrService.success('با موفقیت وارد شدید', 'موفق''); | ||
_this.SetCorrectTokenInfo(ret.Item); | ||
} | ||
else { | ||
// this.toastrService.error(ret.ErrorMessage, 'خطا در ورود'); | ||
} | ||
return ret; | ||
// } | ||
})); | ||
@@ -141,15 +106,10 @@ }; | ||
return this.http | ||
.post(this.baseUrl + this.getModuleCotrolerUrl() + 'renewToken', model, { | ||
.post(this.baseUrl + this.getModuleCotrolerUrl() + '/renewToken', model, { | ||
headers: this.getHeaders(), | ||
}) | ||
.pipe(operators_1.catchError(this.handleError), operators_1.map(function (ret) { | ||
// if (ret) { | ||
if (ret.IsSuccess) { | ||
_this.SetCorrectTokenInfo(ret.Item); | ||
} | ||
else { | ||
// this.toastrService.error(ret.ErrorMessage, 'خطا در دریافت توکن'); | ||
} | ||
return ret; | ||
// } | ||
})); | ||
@@ -159,37 +119,12 @@ }; | ||
return this.http | ||
.post(this.baseUrl + this.getModuleCotrolerUrl() + 'changePassword', model, { | ||
.post(this.baseUrl + this.getModuleCotrolerUrl() + '/changePassword', model, { | ||
headers: this.getHeaders(), | ||
}) | ||
.pipe(operators_1.catchError(this.handleError), operators_1.map(function (ret) { | ||
// if (ret) { | ||
if (ret.IsSuccess) { | ||
// this.toastrService.success( | ||
// 'تغییر پسورد با موفقیت انجام شد', | ||
// 'موفق'' | ||
// ); | ||
} | ||
else { | ||
// this.toastrService.error( | ||
// ret.ErrorMessage, | ||
// 'خطا در تغییر پسورد حساب کاربری' | ||
// ); | ||
} | ||
return ret; | ||
// } | ||
})); | ||
}; | ||
CoreAuthService.prototype.ServiceForgetPassword = function (model) { | ||
return this.http.post(this.baseUrl + this.getModuleCotrolerUrl() + 'forgetPassword', model).pipe(operators_1.catchError(this.handleError), operators_1.map(function (ret) { | ||
// if (ret) { | ||
if (ret.IsSuccess) { | ||
// this.toastrService.success( | ||
// 'دستور عمل بازیابی پسورد به آدرس ایمیل شما ارسال شد', | ||
// 'موفق'' | ||
// ); | ||
} | ||
else { | ||
// this.toastrService.error(ret.ErrorMessage, 'خطا در بازیابی پسورد'); | ||
} | ||
return this.http.post(this.baseUrl + this.getModuleCotrolerUrl() + '/forgetPassword', model).pipe(operators_1.catchError(this.handleError), operators_1.map(function (ret) { | ||
return ret; | ||
// } | ||
})); | ||
@@ -201,9 +136,7 @@ }; | ||
return this.http | ||
.post(this.baseUrl + this.getModuleCotrolerUrl() + 'signOut', model, { | ||
.post(this.baseUrl + this.getModuleCotrolerUrl() + '/signOut', model, { | ||
headers: this.getHeaders(), | ||
}) | ||
.pipe(operators_1.catchError(this.handleError), operators_1.map(function (ret) { | ||
// this.tokenString = null; | ||
_this.SetCorrectTokenInfo(null); | ||
// this.toastrService.success('خروح شما با موفقیت انجام شد', 'موفق''); | ||
return ret; | ||
@@ -217,3 +150,3 @@ })); | ||
return this.http | ||
.post(this.baseUrl + this.getModuleCotrolerUrl() + 'existToken', model, { | ||
.post(this.baseUrl + this.getModuleCotrolerUrl() + '/existToken', model, { | ||
headers: this.getHeaders(), | ||
@@ -228,84 +161,2 @@ }) | ||
}; | ||
CoreAuthService.prototype.loggedIn = function () { | ||
// const user: TokenInfoModel; | ||
// this.subManager.add( | ||
// this.store.select(fromStore.getLoggedUserState).subscribe((data) => { | ||
// user = data; | ||
// }) | ||
// ); | ||
var token = this.CheckToken(); | ||
if (token == null || token === undefined) { | ||
return false; | ||
} | ||
var parts = token.split('.'); | ||
if (parts.length !== 3) { | ||
return false; | ||
} | ||
// const decoded = this.jwtHelper.urlBase64Decode(parts[1]); | ||
// if (!decoded) { | ||
// return false; | ||
// } | ||
// if (user.provider === 'GOOGLE' || user.provider === 'FACEBOOK') { | ||
// var socialUser: SocialUser; | ||
// this.socialAuthService.authState.subscribe((user) => { | ||
// socialUser = user; | ||
// }); | ||
// if (socialUser == null) { | ||
// return false | ||
// } | ||
// } | ||
return true; | ||
}; | ||
CoreAuthService.prototype.isAuthenticated = function () { | ||
var token = this.CheckToken(); | ||
if (token && token !== 'null') { | ||
this.subManager | ||
.add(); | ||
// if (user.provider === 'GOOGLE' || user.provider === 'FACEBOOK') { | ||
// var socialUser: SocialUser; | ||
// this.socialAuthService.authState.subscribe((user) => { | ||
// socialUser = user; | ||
// }); | ||
// if (socialUser == null) { | ||
// return false | ||
// } | ||
// } | ||
return true; | ||
} | ||
else { | ||
return true; // false; | ||
} | ||
}; | ||
// isAdmin(): boolean { | ||
// if (this.roleMatch(['Admin'])) { | ||
// return true; | ||
// } | ||
// return false; | ||
// } | ||
// roleMatch(allowedRoles): boolean { | ||
// let isMatch = false; | ||
// const userRoles = this.userRoles; | ||
// if (Array.isArray(userRoles)) { | ||
// allowedRoles.forEach((element) => { | ||
// if (userRoles.includes(element)) { | ||
// isMatch = true; | ||
// return; | ||
// } | ||
// }); | ||
// } else { | ||
// allowedRoles.forEach((element) => { | ||
// if (userRoles === element) { | ||
// isMatch = true; | ||
// return; | ||
// } | ||
// }); | ||
// } | ||
// return isMatch; | ||
// } | ||
CoreAuthService.prototype.getDashboardUrl = function () { | ||
return 'core/site/select'; | ||
}; | ||
CoreAuthService.prototype.getLoginUrl = function () { | ||
return '/auth/login'; | ||
}; | ||
return CoreAuthService; | ||
@@ -312,0 +163,0 @@ }(apiServerBase_service_1.ApiServerBase)); |
{ | ||
"name": "ntk-cms-api", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "Ntk Cms Api And Model", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
404744
6456