mirror of
https://github.com/jambonz/jambonz-webapp.git
synced 2026-10-31 07:44:26 +00:00
fix the webapp blocking account name if exists in anohter SP (#229)
* fix the webapp blocking account name if exists in anohter SP * hard reload when changing SP * password settings enhance special chars --------- Co-authored-by: eglehelms <e.helms@cognigy.com>
This commit is contained in:
1 parent
49c18ebd26
commit
1bfc722960
3 files changed
+13
-3
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useState, useMemo } from "react";
|
||||
import { classNames, M, Icon, Button } from "@jambonz/ui-kit";
|
||||
import { Link, useLocation } from "react-router-dom";
|
||||
import { Link, useLocation, useNavigate } from "react-router-dom";
|
||||
|
||||
import { Icons, ModalForm } from "src/components";
|
||||
import { naviTop, naviByo } from "./items";
|
||||
@@ -20,6 +20,7 @@ import "./styles.scss";
|
||||
import { ScopedAccess } from "src/components/scoped-access";
|
||||
import { Scope, UserData } from "src/store/types";
|
||||
import { USER_ADMIN } from "src/api/constants";
|
||||
import { ROUTE_LOGIN } from "src/router/routes";
|
||||
|
||||
type CommonProps = {
|
||||
handleMenu: () => void;
|
||||
@@ -61,6 +62,7 @@ export const Navi = ({
|
||||
handleLogout,
|
||||
}: NaviProps) => {
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const user = useSelectState("user");
|
||||
const accessControl = useSelectState("accessControl");
|
||||
const serviceProviders = useSelectState("serviceProviders");
|
||||
@@ -160,6 +162,7 @@ export const Navi = ({
|
||||
onChange={(e) => {
|
||||
setSid(e.target.value);
|
||||
setActiveSP(e.target.value);
|
||||
navigate(ROUTE_LOGIN);
|
||||
}}
|
||||
disabled={user?.scope !== USER_ADMIN}
|
||||
>
|
||||
|
||||
@@ -158,7 +158,14 @@ export const AccountForm = ({ apps, limits, account }: AccountFormProps) => {
|
||||
? accounts.filter((a) => a.account_sid !== account.data!.account_sid)
|
||||
: accounts;
|
||||
|
||||
if (filtered.find((a) => a.name === name)) {
|
||||
if (
|
||||
account &&
|
||||
filtered.find(
|
||||
(a) =>
|
||||
a.service_provider_sid !== account.data!.service_provider_sid &&
|
||||
a.name === name
|
||||
)
|
||||
) {
|
||||
setMessage(
|
||||
"The name you have entered is already in use on another one of your accounts."
|
||||
);
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ export const isValidPasswd = (
|
||||
password.length >= passwordSettings?.min_password_length &&
|
||||
(passwordSettings?.require_digit ? /\d/.test(password) : true) &&
|
||||
(passwordSettings?.require_special_character
|
||||
? /[!@#$%^&*(),.?"';:{}|<>+~]/.test(password)
|
||||
? /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(password)
|
||||
: true)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user