Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb4f61eb

Browse files
expose resetPassword function with utils
1 parent67df145 commitb4f61eb

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

‎client/packages/lowcoder/src/comps/hooks/utilsComp.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { openApp, recordToSearchStr } from "../../util/appUtils";
88
import{trans}from"i18n";
99
import{logoutAction}from"redux/reduxActions/userActions";
1010
importStoreRegistryfrom"@lowcoder-ee/redux/store/storeRegistry";
11+
importUserApifrom"@lowcoder-ee/api/userApi";
12+
import{messageInstance}from"components/GlobalInstances";
1113

1214
constUtilsCompBase=simpleMultiComp({});
1315
exportletUtilsComp=withExposingConfigs(UtilsCompBase,[]);
@@ -121,4 +123,33 @@ UtilsComp = withMethodExposing(UtilsComp, [
121123
);
122124
},
123125
},
126+
{
127+
method:{
128+
name:"resetPassword",
129+
description:trans("utilsComp.resetPassword"),
130+
params:[
131+
{name:"oldPassword",type:"string"},
132+
{name:"newPassword",type:"string"},
133+
],
134+
},
135+
execute:async(comp,params)=>{
136+
constoldPassword=params?.[0];
137+
constnewPassword=params?.[1];
138+
try{
139+
if(Boolean(oldPassword)&&Boolean(newPassword)){
140+
constresponse=awaitUserApi.updatePassword({
141+
oldPassword:oldPasswordasstring,
142+
newPassword:newPasswordasstring,
143+
});
144+
if(!response.data.success){
145+
throw(newError(response.data.message));
146+
}
147+
}else{
148+
throw(newError('Reset password requires both old and new passwords'))
149+
}
150+
}catch(e:any){
151+
messageInstance.error(e.message)
152+
}
153+
},
154+
}
124155
]);

‎client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2630,6 +2630,7 @@ export const en = {
26302630
"copyToClipboard":"Copy to Clipboard",
26312631
"downloadFile":"Download File",
26322632
"logoutUser" :"Logout User",
2633+
"resetPassword" :"Reset Password",
26332634
},
26342635
"messageComp":{
26352636
"info":"Send a Notification",
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import{useSelector}from"react-redux";
2-
import{getCurrentUser}from"redux/selectors/usersSelectors";
2+
import{getCurrentUser,getUser}from"redux/selectors/usersSelectors";
33

44
exportfunctionuseCurrentUser(){
55
constcurrentUser=useSelector(getCurrentUser);
6-
returncurrentUser;
6+
const{ hasPassword}=useSelector(getUser);
7+
return{...currentUser, hasPassword};
78
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp