Password Reset + Bugfixes
This commit is contained in:
@@ -35,8 +35,8 @@ export default class API {
|
||||
return data && data.success && data.loggedIn;
|
||||
}
|
||||
|
||||
async editUser(id, username, email, password, groups) {
|
||||
return this.apiCall("user/edit", { "id": id, "username": username, "email": email, "password": password, "groups": groups });
|
||||
async editUser(id, username, email, password, groups, confirmed) {
|
||||
return this.apiCall("user/edit", { id: id, username: username, email: email, password: password, groups: groups, confirmed: confirmed });
|
||||
}
|
||||
|
||||
async logout() {
|
||||
|
||||
@@ -43,7 +43,8 @@ export default class EditUser extends React.Component {
|
||||
name: res.user.name,
|
||||
email: res.user.email || "",
|
||||
groups: res.user.groups,
|
||||
password: ""
|
||||
password: "",
|
||||
confirmed: res.user.confirmed
|
||||
}
|
||||
});
|
||||
this.parent.api.fetchGroups(1, 50).then((res) => {
|
||||
@@ -61,11 +62,15 @@ export default class EditUser extends React.Component {
|
||||
|
||||
onChangeInput(event) {
|
||||
const target = event.target;
|
||||
const value = target.value;
|
||||
let value = target.value;
|
||||
const name = target.name;
|
||||
|
||||
if (target.type === "checkbox") {
|
||||
value = !!target.checked;
|
||||
}
|
||||
|
||||
if (name === "search") {
|
||||
this.setState({ ...this.state, searchString: value });
|
||||
this.setState({...this.state, searchString: value});
|
||||
} else {
|
||||
this.setState({ ...this.state, user: { ...this.state.user, [name]: value } });
|
||||
}
|
||||
@@ -85,9 +90,10 @@ export default class EditUser extends React.Component {
|
||||
const email = this.state.user["email"];
|
||||
let password = this.state.user["password"].length > 0 ? this.state.user["password"] : null;
|
||||
let groups = Object.keys(this.state.user.groups);
|
||||
let confirmed = this.state.user["confirmed"];
|
||||
|
||||
this.setState({ ...this.state, isSaving: true});
|
||||
this.parent.api.editUser(id, username, email, password, groups).then((res) => {
|
||||
this.parent.api.editUser(id, username, email, password, groups, confirmed).then((res) => {
|
||||
let alerts = this.state.alerts.slice();
|
||||
|
||||
if (res.success) {
|
||||
@@ -262,6 +268,15 @@ export default class EditUser extends React.Component {
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className={"form-check"}>
|
||||
<input type={"checkbox"} className={"form-check-input"}
|
||||
onChange={this.onChangeInput.bind(this)}
|
||||
id={"confirmed"} name={"confirmed"} checked={this.state.user.confirmed}/>
|
||||
<label className={"form-check-label"} htmlFor={"confirmed"}>
|
||||
Confirmed
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<Link to={"/admin/users"} className={"btn btn-info mt-2 mr-2"}>
|
||||
<Icon icon={"arrow-left"}/>
|
||||
Back
|
||||
|
||||
@@ -167,6 +167,8 @@ export default class UserOverview extends React.Component {
|
||||
}
|
||||
|
||||
let user = this.state.users.data[uid];
|
||||
let confirmedIcon = <Icon icon={user["confirmed"] ? "check" : "times"}/>;
|
||||
|
||||
let groups = [];
|
||||
|
||||
for (let groupId in user.groups) {
|
||||
@@ -193,6 +195,7 @@ export default class UserOverview extends React.Component {
|
||||
{getPeriodString(user["registered_at"])}
|
||||
</span>
|
||||
</td>
|
||||
<td className={"text-center"}>{confirmedIcon}</td>
|
||||
<td>
|
||||
<Link to={"/admin/user/edit/" + uid} className={"text-reset"}>
|
||||
<Icon icon={"pencil-alt"} data-effect={"solid"}
|
||||
@@ -212,6 +215,7 @@ export default class UserOverview extends React.Component {
|
||||
<td/>
|
||||
<td/>
|
||||
<td/>
|
||||
<td/>
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
@@ -251,6 +255,7 @@ export default class UserOverview extends React.Component {
|
||||
<th>Email</th>
|
||||
<th>Groups</th>
|
||||
<th>Registered</th>
|
||||
<th className={"text-center"}>Confirmed</th>
|
||||
<th><Icon icon={"tools"} /></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
Reference in New Issue
Block a user