Skip to content

Commit

Permalink
fix: Fix 401 error on sign in page (#2829)
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-dudarev authored Aug 26, 2024
1 parent 04278d1 commit 0237efa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,15 @@ public async Task<ActionResult> Logout()
/// </summary>
[HttpGet]
[Authorize]
[AllowAnonymous]
[Route("currentuser")]
public async Task<ActionResult<UserDetail>> GetCurrentUser()
{
if (User.Identity?.IsAuthenticated != true)
{
return Ok(new { });
}

var user = await UserManager.FindByNameAsync(CurrentUserName);
if (user == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ angular.module('platformWebApp')
$scope.loginProgress = true;
// Try to login
authService.login($scope.user.email, $scope.user.password, $scope.user.remember).then(
function (loggedIn) {
if (!loggedIn) {
$scope.loginProgress = false;
$scope.authError = 'invalidCredentials';
function (result) {
$scope.loginProgress = false;
if (!result || !result.succeeded) {
$scope.authError = 'The login or password is incorrect.';
}
},
function (x) {
Expand All @@ -72,7 +72,7 @@ angular.module('platformWebApp')
});
};

$scope.togglePassword = function() {
$scope.togglePassword = function () {
$scope.showPassword = !$scope.showPassword;
}
});
Expand Down

0 comments on commit 0237efa

Please sign in to comment.