Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const verifyUser = (event, context, callback) => {
context.callbackWaitsForEmptyEventLoop = false;
const {username, verification} = JSON.parse(event.body);
const data = {
username,
'code': verification
}
console.log(JSON.stringify(data))
Auth.confirmSignUp(username, verification)
.then(resposneData => onUserConfirmed(resposneData, callback))
.catch(error => renderServerError(callback, error));
}
async function confirmSignUp({ username, confirmationCode }, updateFormType) {
try {
await Auth.confirmSignUp(username, confirmationCode)
console.log('confirm sign up success!')
updateFormType('signIn')
} catch (err) {
console.log('error signing up..', err)
}
}
confirmSignUp = async () => {
const { username, authenticationCode } = this.state
try {
await Auth.confirmSignUp(username, authenticationCode)
console.log('successully signed up!')
alert('User signed up successfully!')
this.setState({ ...initialState })
} catch (err) {
console.log('error confirming signing up: ', err)
}
}
render() {
confirm() {
const username = this.usernameFromAuthData() || this.inputs.username;
const { code } = this.inputs;
logger.debug('username: ' + username);
Auth.confirmSignUp(username, code)
.then(data => this.changeState('signIn', data))
.catch(err => this.error(err));
}
export const confirmSignUp = ({username, code}) => {
return Auth.confirmSignUp(username, code)
}
confirm() {
const { username, code } = this.state;
logger.debug('Confirm Sign Up for ' + username);
Auth.confirmSignUp(username, code)
.then(data => this.changeState('signedUp'))
.catch(err => this.error(err));
}
const confirmSignUpPromise = ({ username, verification }) => Auth.confirmSignUp(username, verification);
confirm () {
const username = this.usernameFromAuthData() || this.inputs.username;
const { code } = this.inputs;
if (!Auth || typeof Auth.confirmSignUp !== "function") {
throw new Error(
"No Auth module found, please ensure @aws-amplify/auth is imported"
);
}
this.setState({ loading: true });
Auth.confirmSignUp(username, code)
.then(data => {
this.setState({ loading: false });
this.changeState("signIn", data);
})
.catch(err => {
this.setState({ loading: false });
message.error(err.message);
});
};