mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-22 16:38:21 +00:00
Include name while setting up new account
This commit is contained in:
parent
fb1494a561
commit
100e4ef28e
3 changed files with 53 additions and 23 deletions
|
|
@ -5,7 +5,7 @@ class UsersController < ApplicationController
|
|||
user = User.where(invitation_token: params[:token]).first
|
||||
|
||||
if user
|
||||
user.update(password: params[:password], invitation_token: nil)
|
||||
user.update(first_name: params[:first_name], last_name: params[:last_name], password: params[:password], invitation_token: nil)
|
||||
user.organization_users.first.update(status: 'active')
|
||||
|
||||
if params[:new_signup]
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ class InvitationPage extends React.Component {
|
|||
e.preventDefault();
|
||||
|
||||
const token = this.props.match.params.token;
|
||||
const { password, organization, newSignup } = this.state;
|
||||
const { password, organization, newSignup, firstName, lastName } = this.state;
|
||||
|
||||
this.setState({ isLoading: true });
|
||||
|
||||
userService
|
||||
.setPasswordFromToken({ token, password, organization, newSignup })
|
||||
.setPasswordFromToken({ token, password, organization, newSignup, firstName, lastName })
|
||||
.then(() => {
|
||||
this.setState({ isLoading: false });
|
||||
toast.success('Password has been set successfully.', { hideProgressBar: true, position: 'top-center' });
|
||||
|
|
@ -47,27 +47,54 @@ class InvitationPage extends React.Component {
|
|||
<div className="container-tight py-2">
|
||||
<div className="text-center mb-4">
|
||||
<a href=".">
|
||||
<img src="/images/logo-text.svg" height="30" alt="" />
|
||||
<img src="/assets/images/logo-text.svg" height="30" alt="" />
|
||||
</a>
|
||||
</div>
|
||||
<form className="card card-md" action="." method="get" autoComplete="off">
|
||||
<div className="card-body">
|
||||
<h2 className="card-title text-center mb-4">Set up your account</h2>
|
||||
{newSignup === "true" &&
|
||||
<div className="mb-3">
|
||||
<label className="form-label">Organization</label>
|
||||
<div className="input-group input-group-flat">
|
||||
<input
|
||||
onChange={this.handleChange}
|
||||
name="organization"
|
||||
type="text"
|
||||
className="form-control"
|
||||
placeholder="Organization"
|
||||
autoComplete="off"
|
||||
/>
|
||||
<span className="input-group-text"></span>
|
||||
<>
|
||||
<div className="mb-3">
|
||||
<label className="form-label">First name</label>
|
||||
<div className="input-group input-group-flat">
|
||||
<input
|
||||
onChange={this.handleChange}
|
||||
name="firstName"
|
||||
type="text"
|
||||
className="form-control"
|
||||
autoComplete="off"
|
||||
/>
|
||||
<span className="input-group-text"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label className="form-label">Last name</label>
|
||||
<div className="input-group input-group-flat">
|
||||
<input
|
||||
onChange={this.handleChange}
|
||||
name="lastName"
|
||||
type="text"
|
||||
className="form-control"
|
||||
autoComplete="off"
|
||||
/>
|
||||
<span className="input-group-text"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label className="form-label">Organization</label>
|
||||
<div className="input-group input-group-flat">
|
||||
<input
|
||||
onChange={this.handleChange}
|
||||
name="organization"
|
||||
type="text"
|
||||
className="form-control"
|
||||
autoComplete="off"
|
||||
/>
|
||||
<span className="input-group-text"></span>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
|
||||
<div className="mb-3">
|
||||
|
|
@ -78,7 +105,6 @@ class InvitationPage extends React.Component {
|
|||
name="password"
|
||||
type="password"
|
||||
className="form-control"
|
||||
placeholder="Password"
|
||||
autoComplete="off"
|
||||
/>
|
||||
<span className="input-group-text"></span>
|
||||
|
|
@ -92,19 +118,21 @@ class InvitationPage extends React.Component {
|
|||
name="password_confirmation"
|
||||
type="password"
|
||||
className="form-control"
|
||||
placeholder="Password"
|
||||
autoComplete="off"
|
||||
/>
|
||||
<span className="input-group-text"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="form-footer">
|
||||
<p>
|
||||
By clicking the button below, you agree to our <a href="https://tooljet.io/terms">Terms and Conditions</a>.
|
||||
</p>
|
||||
<button
|
||||
className={`btn btn-primary w-100 ${isLoading ? ' btn-loading' : ''}`}
|
||||
className={`btn mt-2 btn-primary w-100 ${isLoading ? ' btn-loading' : ''}`}
|
||||
onClick={this.setPassword}
|
||||
disabled={isLoading}
|
||||
>
|
||||
Set Password
|
||||
Finish account setup
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -30,12 +30,14 @@ function deleteUser(id) {
|
|||
return fetch(`${config.apiUrl}/users/${id}`, requestOptions).then(handleResponse);
|
||||
}
|
||||
|
||||
function setPasswordFromToken({ token, password, organization, newSignup }) {
|
||||
function setPasswordFromToken({ token, password, organization, newSignup, firstName, lastName }) {
|
||||
const body = {
|
||||
token,
|
||||
password,
|
||||
organization,
|
||||
new_signup: newSignup
|
||||
new_signup: newSignup,
|
||||
first_name: firstName,
|
||||
last_name: lastName
|
||||
};
|
||||
|
||||
const requestOptions = { method: 'POST', headers: authHeader(), body: JSON.stringify(body) };
|
||||
|
|
|
|||
Loading…
Reference in a new issue