mirror of
https://github.com/farcasclaudiu/LanBackup.git
synced 2026-06-22 07:01:08 +03:00
minor fixes
This commit is contained in:
@@ -61,7 +61,11 @@ export class ProfileComponent implements OnInit {
|
||||
}
|
||||
else {
|
||||
//notify something not OK
|
||||
this.showToast({ title: "Password change error", body: data.errors, type: ToastType.error });
|
||||
if (!data.isLoggedIn) {
|
||||
localStorage.removeItem("user");
|
||||
this._router.navigate(['/']);//to default or last url
|
||||
}
|
||||
this.showToast({ title: "Password change error", body: data.errors.map(err => err.description), type: ToastType.error });
|
||||
}
|
||||
}, err => {
|
||||
this.log.error(err);
|
||||
|
||||
@@ -14,6 +14,7 @@ export class User {
|
||||
email: string;
|
||||
password: string;
|
||||
newpassword: string;
|
||||
isLoggedIn: boolean;
|
||||
isAdmin: boolean;
|
||||
succeeded: boolean;
|
||||
isLockedOut: boolean;
|
||||
|
||||
@@ -5,7 +5,6 @@ import { AppModule } from './app/app.module';
|
||||
|
||||
import * as $ from 'jquery';
|
||||
import 'bootstrap';
|
||||
//import { AppInsightsModule, AppInsightsService } from 'ng2-appinsights';
|
||||
|
||||
// Enable either Hot Module Reloading or production mode
|
||||
if (module['hot']) {
|
||||
@@ -23,8 +22,3 @@ if (document.readyState === 'complete') {
|
||||
} else {
|
||||
document.addEventListener('DOMContentLoaded', bootApplication);
|
||||
}
|
||||
|
||||
//var appIns: AppInsightsService = new AppInsightsService('');
|
||||
//appIns.Init({
|
||||
// instrumentationKey: '9f667285-ff2c-4626-a8da-1db518593323' //TODO - MOVE INTO A CONFIG FILE THAT SHOULD NOT BE COMMITED
|
||||
//});
|
||||
@@ -9,7 +9,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using LanBackup.WebApp.Models.Telemetry;
|
||||
using System.Net;
|
||||
|
||||
namespace LanBackup.WebApp.Controllers
|
||||
{
|
||||
@@ -146,6 +145,7 @@ namespace LanBackup.WebApp.Controllers
|
||||
if (user != null)
|
||||
{
|
||||
dtouser.Succeeded = false;
|
||||
dtouser.IsLoggedIn = true;
|
||||
var result = await _userManager.ChangePasswordAsync(user, dtouser.Password, dtouser.NewPassword);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
@@ -162,7 +162,14 @@ namespace LanBackup.WebApp.Controllers
|
||||
return BadRequest(msg);
|
||||
}
|
||||
}
|
||||
return StatusCode((int)HttpStatusCode.Unauthorized, "User not logged in");// Unauthorized();
|
||||
else
|
||||
{
|
||||
this.telemetry.TrackEvent("ChangePasswordNotLoggedIn");
|
||||
dtouser.Succeeded = false;
|
||||
dtouser.IsLoggedIn = false;
|
||||
dtouser.Errors = new IdentityError[] { new IdentityError() { Description = "User not logged in" } };
|
||||
return Ok(dtouser);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace LanBackup.WebApp.Models
|
||||
public string Email { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string NewPassword { get; set; }
|
||||
public bool IsLoggedIn { get; set; }
|
||||
public bool IsAdmin { get; set; }
|
||||
public bool Succeeded { get; set; }
|
||||
public bool IsLockedOut { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user